为什么tkinter窗口是空白的?

时间:2016-10-11 12:06:51

标签: python-2.7 tkinter

我的代码使用pygame来播放其位置内的所有MIDI文件,但是Tkinter Slider Window应该显示但不会显示。我不知道为什么。

import os,fnmatch,pygame
import Tkinter as tk
pygame.mixer.init()
root = tk.Tk()
List = []
Song = 0
def getThrottle(event):
    Volume = Throttle.get()
    print "|"*((Volume)*50/100)
def Update():
    List = []
    for file in os.listdir('.'):
        if fnmatch.fnmatch(file, '*.mid'):
            List.append(file)
    return List
class Slider:
    def _Init_(self,root):
        self.Throttle = self.Scale(master, from_=0, to=100, tickinterval=10, length=200, orient=HORIZONTAL, command=getThrottle)
        self.Throttle.set(0)
        self.Throttle.pack()
List = Update()
S = Slider()
root.mainloop()
print List
while True:
    while Song <= len(List):
        pygame.mixer.music.load(List[Song])
        pygame.mixer.music.play(1)
        while pygame.mixer.music.get_busy() == True:
            List=Update()
        Song = 3
    Song = 0

0 个答案:

没有答案