Python, kehren Sie aus der Unterprogramme mit Tkinter -Fortschrittsleiste zurückPython

Python-Programme
Anonymous
 Python, kehren Sie aus der Unterprogramme mit Tkinter -Fortschrittsleiste zurück

Post by Anonymous »

Ich schreibe ein Skript, das die Tkinter -Fortschrittsleiste verwendet, die die Anzahl der Dateien verfolgt. Gibt zurück. < /p>

Code: Select all

 from tkinter import *
from tkinter.ttk import *

def my_sub_routine(k):
p = 0
def test_read(p):
print("reading line number",p,",number of lines to read =  ",k)
if p < k:
p += 1
test_read(p)

if p == k:
print("should be gone")
return None
test_read(p)

def main():
GB = 15  # this would be number of file to process
root = Tk()
root.title("Progress Window")
root.geometry("300x300")
progress = Progressbar(root, orient=HORIZONTAL, length=200 , maximum=GB)
progress.pack()
i = 0
def my_func(i):
i += 1
progress['value'] = i
print("i: ",i)
root.after(1000, my_sub_routine,10) #this would be a filename with 10 lines in it.
if i == GB:
quit()
my_func(i)
mainloop()

if __name__ == '__main__':
main()

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post