python - Tkinter -tkinter.TclError -



python - Tkinter -tkinter.TclError -

i have next code:

from tkinter import * urllib import urlretrieve import webbrowser import ttk def get_latest_launcher(): webbrowser.open("johndoe.com/get_latest") global percent percent = 0 def report(count, blocksize, totalsize): percent += int(count*blocksize*100/totalsize) homepage = "http://johndoe.com" root = tk() root.title("future of wars launcher") button(text="get latest version", command=get_latest_launcher).pack() global mpb mpb = ttk.progressbar(root, orient="horizontal", variable = percent,length="100", mode="determinate") mpb.pack() root.mainloop() urlretrieve("https://~url~to~my~file.com", "smyprogram.exe",reporthook=report)

however, if run script, won't display progressbar, , display button. wont download file, , cursor blink. however, if close gui window, next code:

traceback(most recent phone call last): file "c:\users\user\desktop\downloader.py", line 28 in <module> mpb = ttk.progressbar(root, orient="horizontal", variable = percent,length="100",mode="determinate") file "c:\users/user\desktop\pyttk-0.3\ttk.py" line 1047, in __init__ widget.__init__(self, master, "ttk::progressbar", kw) file "c:\users/user\desktop\pyttk-0.3\ttk.py", line 574, in __init__ tkinter.widget.__init__(self, master, widgetname, kw=kw) file "c:\python26\lib\lib-tk\tkinter.py", line 1930, in __init__ (widgetname, self._w) + + self._options(cnf)) _tkinter.tclerror: isn't tk applicationnull main window

what's wrong?

variable = percent wrong. must utilize tkinter variables objects. such intvar.

python tkinter progress-bar ttk

Comments

Popular posts from this blog

model view controller - MVC Rails Planning -

ruby on rails - Devise Logout Error in RoR -

html - Submenu setup with jquery and effect 'fold' -