Tkinter Python User Interface Leaving JES - return to Python IDLE In Python IDLE, type from tkinter import * # import Tkinter package myWin = Tk() # create a window … myWin.mainloop()
Widgets Label to display text or an image Button to execute a command Text to display text Checkbutton to select from options Radiobutton to select one of options Entry to enter text input Menu pull-down or popup menu
Simple example Save as xxx.py in C:\100 from tkinter import * def procOk(): print(“OK button is clicked”) def procCancel(): print (“Cancel button is clicked”) win = Tk() label = Label(win, text=“Hi!”) butOk = Button(win, text=“Ok”, fg=“red”, command=procOk) butCancel = Button(win, text=“Cancel”, bg=“yellow”, command=procCancel) label.pack() # place the label in window butOk.pack() # place the button in window butCancel.pack() win.mainloop() Save as xxx.py in C:\100 From the ‘Run’ menu, select ‘Run module.’
Lab_0415 Take a look at tutorial in http://www.python-course.eu/python_tkinter.php and add examples of the following widgets into your program Checkbutton to select from options Radiobutton to select one of options Entry to enter text input Menu pull-down or popup menu Do not use images (package is not available at your machine) Do NOT email to the grader