add gui.py
parent
3a31879d70
commit
6d41db8051
@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env python3
|
||||
from tkinter import *
|
||||
from tkinter import ttk
|
||||
|
||||
def init_gui(root):
|
||||
|
||||
def btn_apply_clicked():
|
||||
try:
|
||||
width = int(input_width.get())
|
||||
height = int(input_height.get())
|
||||
print(f'apply clicked, resolution: {width}x{height}')
|
||||
|
||||
except:
|
||||
print('Please enter a valid resolution')
|
||||
|
||||
root.title('Generative Art')
|
||||
algos = ['waves', 'hyphae']
|
||||
|
||||
frame_top = ttk.Frame(root, padding=10)
|
||||
frame_top.pack(side=TOP)
|
||||
frame_top.grid()
|
||||
#ttk.Label(frame_top, text="Hello World!").grid(column=0, row=0)
|
||||
|
||||
Combo = ttk.Combobox(frame_top, values = algos)
|
||||
Combo.set('Pick an algorithm')
|
||||
Combo.grid(column=0, row=0)
|
||||
|
||||
input_width = ttk.Entry(frame_top, width=6)
|
||||
input_width.insert(0, 'Width')
|
||||
input_width.grid(column=1, row=0)
|
||||
input_height = ttk.Entry(frame_top, width=6)
|
||||
input_height.insert(0, 'Height')
|
||||
input_height.grid(column=2, row=0)
|
||||
|
||||
ttk.Button(frame_top, text="Apply", command=btn_apply_clicked).grid(column=3, row=0)
|
||||
ttk.Button(frame_top, text="Quit", command=root.destroy).grid(column=4, row=0)
|
||||
|
||||
frame_left = ttk.Frame(root)
|
||||
frame_left.pack(side=LEFT)
|
||||
frame_right = ttk.Frame(root)
|
||||
frame_righ.pack(side=RIGHT)
|
||||
|
||||
def main():
|
||||
root = Tk()
|
||||
init_gui(root)
|
||||
root.mainloop()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
Loading…
Reference in New Issue