Skip to Main Content

DevOps, CI/CD and Automation

Python GUI - Widget and Root

Below both snippet returns the same result. Anyone, please share with us how both works? the internal difference, which is good? etc..,

Snippet 1:

from tkinter import *
widget = Button(None, text='Press me to quit' , command=quit)
widget.pack()
widget.mainloop()

Snippet 2:

from tkinter import *
root = Tk()
Button (root, text='Press Me', command=root.quit).pack(side=LEFT)
root.mainloop()

Comments
Post Details
Added on Jul 15 2021
0 comments
105 views