Forum Stats

  • 3,759,893 Users
  • 2,251,611 Discussions
  • 7,870,858 Comments

Discussions

Python GUI - Widget and Root

SureshDooly-Oracle
SureshDooly-Oracle Member Posts: 35 Employee

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()

Tagged: