From 5a591d08ed320b7ab291a3ff0200849479b587c1 Mon Sep 17 00:00:00 2001 From: "Toby C. Cornish" Date: Thu, 4 Nov 2021 17:37:58 -0600 Subject: [PATCH 1/3] Create new_gui.py --- new_gui.py | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 new_gui.py diff --git a/new_gui.py b/new_gui.py new file mode 100644 index 0000000..32593b9 --- /dev/null +++ b/new_gui.py @@ -0,0 +1,48 @@ +from tkinter import * +import tkinter.messagebox as box + +def main(): + root = Tk() + root.title('') + + #frame = Frame(root) + + listbox = Listbox(root,width=50,height=20) + #scrollbar = Scrollbar(listbox) + #listbox.config(yscrollcommand = scrollbar.set) + #scrollbar.config(command = listbox.yview) + + listbox.insert( 1, '' ) + listbox.insert( 2, '' ) + listbox.insert( 3, '' ) + + btn_add = Button(root, text = 'Add file', command=add_files) + btn_add.grid(row=0,column=1,sticky=NW) + btn_delete = Button(root, text = 'Delete file', command=delete_selected_files) + btn_delete_all = Button(root, text = 'Delete all files', command=delete_all_files) + + listbox.grid(row=0,column=0,sticky=NW,padx=5,pady=5) + btn_add.grid(row=1,column=0,sticky=NW,padx=5,pady=5) + btn_delete.grid(row=1,column=1,sticky=NW,padx=5,pady=5) + btn_delete_all.grid(row=1,column=2,sticky=NW,padx=5,pady=5) + + #btn_add.pack(side = RIGHT, padx = 5) + #btn_delete.pack(side = RIGHT, padx = 5) + #btn_delete_all.pack(side = RIGHT, padx = 5) + + #frame.pack(padx = 30, pady = 30) + + root.mainloop() + +def add_files(): + listbox.insert(END,'myfile.svs') + +def delete_selected_files(): + for i in listbox.curselection(): + listbox.delete(i) + +def delete_all_files(): + listbox.delete(0,END) + +if __name__ == '__main__': + main() From 8a5423f3059f0a153d245ed1ecca1cca268b2b58 Mon Sep 17 00:00:00 2001 From: "Toby C. Cornish" Date: Fri, 5 Nov 2021 12:49:02 -0600 Subject: [PATCH 2/3] Update new_gui.py - moved gui to a class - added some other UI elements --- new_gui.py | 81 +++++++++++++++++++++++++++++++++--------------------- 1 file changed, 50 insertions(+), 31 deletions(-) diff --git a/new_gui.py b/new_gui.py index 32593b9..990b6f0 100644 --- a/new_gui.py +++ b/new_gui.py @@ -1,48 +1,67 @@ from tkinter import * import tkinter.messagebox as box -def main(): - root = Tk() - root.title('') +class App(Tk): + def __init__(self): + super().__init__() + + self.title('Remove label from WSIs') + + #frame = Frame(root) - #frame = Frame(root) + self.listbox = Listbox(self,width=50,height=20,selectmode=EXTENDED) + self.listbox2 = Listbox(self,width=50,height=20,selectmode=EXTENDED) + #scrollbar = Scrollbar(listbox) + #listbox.config(yscrollcommand = scrollbar.set) + #scrollbar.config(command = listbox.yview) - listbox = Listbox(root,width=50,height=20) - #scrollbar = Scrollbar(listbox) - #listbox.config(yscrollcommand = scrollbar.set) - #scrollbar.config(command = listbox.yview) + self.listbox.insert( 1, '' ) + self.listbox.insert( 2, '' ) + self.listbox.insert( 3, '' ) - listbox.insert( 1, '' ) - listbox.insert( 2, '' ) - listbox.insert( 3, '' ) + self.btn_add = Button(self, text = 'Add file', command=self.add_files) + self.btn_add.grid(row=0,column=1,sticky=NW) + self.btn_delete = Button(self, text = 'Delete file', command=self.delete_selected_files) + self.btn_delete_all = Button(self, text = 'Delete all files', command=self.delete_all_files) - btn_add = Button(root, text = 'Add file', command=add_files) - btn_add.grid(row=0,column=1,sticky=NW) - btn_delete = Button(root, text = 'Delete file', command=delete_selected_files) - btn_delete_all = Button(root, text = 'Delete all files', command=delete_all_files) + self.btn_add_selection = Button(self, text = '-->', command=self.add_selected_files) + self.btn_remove_selection = Button(self, text = '<--', command=self.remove_selected_files) - listbox.grid(row=0,column=0,sticky=NW,padx=5,pady=5) - btn_add.grid(row=1,column=0,sticky=NW,padx=5,pady=5) - btn_delete.grid(row=1,column=1,sticky=NW,padx=5,pady=5) - btn_delete_all.grid(row=1,column=2,sticky=NW,padx=5,pady=5) + self.listbox.grid(row=0,column=0,sticky=NW,padx=5,pady=5) + self.listbox2.grid(row=0,column=3,sticky=NW,padx=5,pady=5) + self.btn_add.grid(row=1,column=0,sticky=NW,padx=5,pady=5) + self.btn_delete.grid(row=1,column=1,sticky=NW,padx=5,pady=5) + self.btn_delete_all.grid(row=1,column=2,sticky=NW,padx=5,pady=5) + self.btn_add_selection.grid(row=0,column=1,sticky=NW,padx=5,pady=5) + self.btn_remove_selection.grid(row=0,column=2,sticky=NW,padx=5,pady=5) - #btn_add.pack(side = RIGHT, padx = 5) - #btn_delete.pack(side = RIGHT, padx = 5) - #btn_delete_all.pack(side = RIGHT, padx = 5) + #btn_add.pack(side = RIGHT, padx = 5) + #btn_delete.pack(side = RIGHT, padx = 5) + #btn_delete_all.pack(side = RIGHT, padx = 5) - #frame.pack(padx = 30, pady = 30) + #frame.pack(padx = 30, pady = 30) - root.mainloop() + def add_selected_files(self): + for i in self.listbox.curselection(): + self.listbox2.insert(END,self.listbox.get(i)) -def add_files(): - listbox.insert(END,'myfile.svs') + def remove_selected_files(self): + for i in self.listbox2.curselection(): + self.listbox2.delete(i) -def delete_selected_files(): - for i in listbox.curselection(): - listbox.delete(i) + def add_files(self): + self.listbox.insert(END,'myfile.svs') -def delete_all_files(): - listbox.delete(0,END) + def delete_selected_files(self): + for i in self.listbox.curselection(): + self.listbox.delete(i) + + def delete_all_files(self): + self.listbox.delete(0,END) + +def main(): + app = App() + app.mainloop() if __name__ == '__main__': main() From b4ba95453d95bd80e63512b03bcae0380a02a847 Mon Sep 17 00:00:00 2001 From: "Toby C. Cornish" Date: Fri, 5 Nov 2021 15:46:48 -0600 Subject: [PATCH 3/3] Update README.md --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index 188ef84..a935a4d 100644 --- a/README.md +++ b/README.md @@ -38,11 +38,7 @@ Changes 1. Basic update using 2to3 2. Updates for byte/str representation and methods -<<<<<<< HEAD -3. TiffFile class modified, because the file class no longer exists to inherit from -======= 3. TiffFile class modified, because "file" no longer exists to inherit from ->>>>>>> d753c77bb8a619ac821de1f69d05ddea2a25f9f4 License -------