commit 2dedbb217d0767f2338f2650f5b3b5c55c88ced1 Author: Cole Deck Date: Fri Feb 26 12:38:11 2021 -0600 first commit diff --git a/main.py b/main.py new file mode 100644 index 0000000..f983a25 --- /dev/null +++ b/main.py @@ -0,0 +1,38 @@ +from tkinter import * +from tkinter.ttk import * + +class Window(Frame): + def __init__(self, master=None): + Frame.__init__(self, master) + self.master = master + +root = Tk() +app = Window(root) + + +def add_base(): + out = [] + for x in combo['values']: + out.append(int(x)) + out.append(int(txt.get())) + combo['values'] = sorted(out) +# set window title +root.wm_title("Numerical converter") +lbl = Label(root, text="Please enter a number!", font=("Arial Bold", 25)) +lbl.grid(column=0, row=0) + +btn = Button(root, text="Add", command=add_base) +btn.grid(column=0, row=4) + +txt = Entry(root,width=10, state='enabled') +txt.grid(column=0, row = 1) + +combo = Combobox(root) +combo['values']= (2, 10, 16) + +combo.current(1) #set the selected item + +combo.grid(column=0, row=3) + +root.geometry('400x300') +root.mainloop() \ No newline at end of file