first commit
commit
2dedbb217d
@ -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()
|
Loading…
Reference in New Issue