So I see codes that look like this:
from Tkinter import *
def main():
root = Tk()
root.geometry("250x150+300+300")
root.title("GUI")
root.mainloop()
But why do they write it in a function? Couldn't you do the same thing by typing this
from Tkinter import *
root = Tk()
root.geometry("250x150+300+300")
root.wm_iconbitmap(r'c:/Python33/DLLs/txteditor.ico')
app = txtEditor(root)
root.mainloop()
Not sure if this is considered a "good" question if not I understand I will remove it. But I am somewhat new to Python and just see this a lot but do not understand why? Any help would be appreciated :-)