Here is an example code that creates a Tkinter window with the given specifications:
main.py465 chars22 lines
We first import the tkinter
module and create the root window using the Tk()
constructor. We then set the window size and background color using the geometry()
and config()
methods respectively.
Next, we create a label widget with some text using the Label()
constructor and pack it in the root window using the pack()
method.
Finally, we create an "OK" button using the Button()
constructor, set its text and command to close the window, and pack it at the bottom of the window.
We start the Tkinter main loop using the mainloop()
method on the root window.
gistlibby LogSnag