i am trying to make a gui and need some help on how to link buttons to certain commands. here is my code:
when i click on EXAM i want it to do grab the number thats enterd in the entry field so i can use it for further calculations. and when i click on quit i want it to exit the program. how do i go about doing this. and also i want to program to keep running unless i click on quit. for example i might want to enter more bus numbers. and the bus number will always be a 6 digit number so what would be advisable as far as definition. should i define it as an integer or a character or something.
Code:
from Tkinter import *
root =Tk()
root.geometry('300x200')
root.title('EXAM')
Label (text='Enter a Bus Number').pack(side=TOP,padx=10,pady=10)
Entry(root, width=6).pack(side=TOP,padx=10,pady=10)
Button(root, text='EXAM').pack(side= TOP, padx=10, pady=10)
Button(root, text='Quit').pack(side= BOTTOM, padx=10, pady=10)
root.mainloop()
Comment