Skip to content

Commit

Permalink
Update PyNutilGUI.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Sharon Christine Yates committed Sep 4, 2024
1 parent e5bfcc5 commit 56efb74
Showing 1 changed file with 50 additions and 42 deletions.
92 changes: 50 additions & 42 deletions PyNutilGUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
root = Tk()
#root.geometry("300x300")
root.title("PyNutil")
root.wm_iconbitmap("Logo_PyNutil.ico")
#photo = tkinter.PhotoImage(file = 'Logo_PyNutil.ico')
#root.wm_iconphoto(False, photo)

arguments = {
"registration_json":None,
"object_colour":None
Expand All @@ -27,9 +31,6 @@
colour = ["colour","black","red","blue","green"]
selected_colour = StringVar(value=colour[0])

# root.wm_iconbitmap("Logo_PyNutil.ico")
#photo = tkinter.PhotoImage(file = 'Logo_PyNutil.ico')
#root.wm_iconphoto(False, photo)
def donothing():
filewin = Toplevel(root)
label = Label(filewin, text="Do nothing")
Expand All @@ -39,7 +40,20 @@ def about_pynutil():
filewin = Toplevel(root)
label = Label(filewin, text="PyNutil is an application for brain-wide mapping using a reference brain atlas")
label.pack()


def open_registration_json():
value = askopenfilename()
arguments["registration_json"] = value
print(arguments)

def choose_colour():
value = colorchooser.askcolor()
arguments["object_colour"] = value
print(list(value[0]))

def start_analysis():
#your code here
return

#Creating a menu
root.option_add('*tearOff', FALSE)
Expand All @@ -59,57 +73,51 @@ def about_pynutil():
menu_file.add_command(label='Exit', command=root.quit)
menu_help.add_command(label='About PyNutil', command=about_pynutil)


#Creating a content frame"
mainframe = ttk.Frame(root, padding="12 12 12 12") # left top right bottom
mainframe.grid(column=0, row=0, sticky=(N, W, E, S))
root.columnconfigure(0, weight=1) # column to expand if there is extra space
root.rowconfigure(0, weight=1) # row to expand if there is extra space

#ttk.Label(mainframe, text="PyNutil settings:").grid(column=0, row=1, sticky=W)
ttk.Label(mainframe, text="Select reference atlas:", width=30).grid(column=1, row=1, sticky=W)
ttk.Label(mainframe, text="Select registration JSON:", width=30).grid(column=1, row=2, sticky=W)
ttk.Label(mainframe, text="Select segmentation folder:", width=30).grid(column=1, row=3, sticky=W)
ttk.Label(mainframe, text="Select object colour:", width=30).grid(column=1, row=4, sticky=W)
ttk.Label(mainframe, text="Select output directory:", width=30).grid(column=1, row=5, sticky=W)
ttk.Label(mainframe, text="Start analysis:", width=30).grid(column=1, row=6, sticky=W)

ttk.Button(mainframe, text="Help", width=8, command="buttonpressed").grid(column=3, row=1, sticky=W)
ttk.Button(mainframe, text="Help", width=8, command="buttonpressed").grid(column=3, row=2, sticky=W)
ttk.Button(mainframe, text="Help", width=8, command="buttonpressed").grid(column=3, row=3, sticky=W)
ttk.Button(mainframe, text="Help", width=8, command="buttonpressed").grid(column=3, row=4, sticky=W)
ttk.Button(mainframe, text="Help", width=8, command="buttonpressed").grid(column=3, row=5, sticky=W)
ttk.Button(mainframe, text="Docs", width=8, command="buttonpressed").grid(column=3, row=6, sticky=W)

def open_registration_json():
value = askopenfilename()
arguments["registration_json"] = value
print(arguments)

def choose_colour():
value = colorchooser.askcolor()
arguments["object_colour"] = value
print(list(value[0]))

def start_analysis():
#your code here
return


#Creating a content frame"
bottomframe = ttk.Frame(root, padding="12 12 12 12") # left top right bottom
mainframe.grid(column=0, row=0, sticky=(N, W, E, S))
root.columnconfigure(0, weight=1) # column to expand if there is extra space
root.rowconfigure(0, weight=1) # row to expand if there is extra space

ttk.OptionMenu(mainframe, selected_atlas, "Reference Atlas", *atlas).grid(column=2, row=1, sticky=W)
#ttk.OptionMenu(mainframe, selected_directory, *directory).grid(column=3, row=2, sticky=W)
#ttk.OptionMenu(mainframe, selected_directory, *directory).grid(column=3, row=3, sticky=W)
#ttk.OptionMenu(mainframe, selected_colour, *colour).grid(column=3, row=4, sticky=W)
#ttk.OptionMenu(mainframe, selected_directory, *directory).grid(column=3, row=5, sticky=W)
# Select reference atlas
ttk.Label(mainframe, text="Select reference atlas:", width=25).grid(column=1, row=1, sticky=W)
ttk.OptionMenu(mainframe, selected_atlas, "Reference Atlas", *atlas).grid(column=2, row=1, columnspan=2)
ttk.Button(mainframe, text="Help", width=8, command="buttonpressed").grid(column=4, row=1, sticky=W)

#ttk.Button(mainframe, width=16, text="Browse...", command="buttonpressed").grid(column=4, row=1, sticky=W)
#Select registration JSON
ttk.Label(mainframe, text="Select registration JSON:", width=25).grid(column=1, row=2, sticky=W)
ttk.Button(mainframe, width=16, text="Browse...", command=open_registration_json).grid(column=2, row=2, sticky=W)
Text(mainframe, height = 1, width =40).grid(column=3, row=2, sticky= W)
ttk.Button(mainframe, text="Help", width=8, command="buttonpressed").grid(column=4, row=2, sticky=W)

#Select segmentation folder
ttk.Label(mainframe, text="Select segmentation folder:", width=25).grid(column=1, row=3, sticky=W)
ttk.Button(mainframe, width=16, text="Browse...", command="buttonpressed").grid(column=2, row=3, sticky=W)
Text(mainframe, height = 1, width =40).grid(column=3, row=3, sticky= W)
ttk.Button(mainframe, text="Help", width=8, command="buttonpressed").grid(column=4, row=3, sticky=W)

#Select object colour
ttk.Label(mainframe, text="Select object colour:", width=25).grid(column=1, row=4, sticky=W)
ttk.Button(mainframe, width=16, text="Colour", command=choose_colour).grid(column=2, row=4, sticky=W)
Text(mainframe, height = 1, width =40).grid(column=3, row=4, sticky= W)
ttk.Button(mainframe, text="Help", width=8, command="buttonpressed").grid(column=4, row=4, sticky=W)

#Select output directory
ttk.Label(mainframe, text="Select output directory:", width=25).grid(column=1, row=5, sticky=W)
ttk.Button(mainframe, width=16, text="Browse...", command="buttonpressed").grid(column=2, row=5, sticky=W)
ttk.Button(mainframe, width=16, text="Run", command="buttonpressed").grid(column= 2, row=6, sticky=W)
Text(mainframe, height = 1, width =40).grid(column=3, row=5, sticky= W)
ttk.Button(mainframe, text="Help", width=8, command="buttonpressed").grid(column=4, row=5, sticky=W)

#Start analysis
ttk.Label(mainframe, text="Start analysis:", width=25).grid(column=1, row=6, sticky=W)
ttk.Button(mainframe, width = 52, text="Run", command="buttonpressed").grid(column= 3, row=6)
ttk.Button(mainframe, text="Docs", width=8, command="buttonpressed").grid(column=4, row=6, sticky=W)

# sunken frame around mainframe
"""
Expand Down

0 comments on commit 56efb74

Please sign in to comment.