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()
Ich schreibe ein Skript, das die Tkinter -Fortschrittsleiste verwendet, die die Anzahl der Dateien verfolgt. Gibt zurück. < /p> [code] 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()
Ich versuche, einige For-Each-Schleifen in Lambda foreach () -Methods zu ändern, um die Möglichkeiten von Lambda-Ausdrücken zu entdecken. Das Folgende scheint möglich zu sein:
Ich habe diesen Codeausschnitt, der nicht funktioniert. Nun, es funktioniert gut, aber es löscht nicht auf meinem Windows -Computer. Bitte helfen Sie!
import time
import sys
Beschreibung
Guru gab seinen Schülern eine Aufgabe. Er gab einen Satz vor, und die Schüler müssen das erste und das letzte Wort vertauschen und alle Mittelzeichen vertauschen. Helfen Sie den...
Beschreibung
Guru gab seinen Schülern eine Aufgabe. Er gab einen Satz vor, und die Schüler müssen das erste und das letzte Wort vertauschen und alle Zeichen zwischen diesen Wörtern vertauschen....