想要与 Tkinter 一起获得输出和 运行 程序

Wanting to get an output and run a programme together with Tkinter

我想要做的是 运行 MIDI 文件列表,我有程序可以列出并播放它们...

import os,fnmatch,pygame
pygame.mixer.init()
List = []
Song = 0
def Update():
    List = []
    for file in os.listdir('.'):
        if fnmatch.fnmatch(file, '*.mid'):
            List.append(file)
    return List
List = Update()
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 = Song + 1
    Song = 0

这目前适用于与它位于同一文件夹中的 .mid 文件,但是我想用该程序实现一个滑块来控制音量,我也已经有了该代码...

from Tkinter import *
master = Tk()

def getThrottle(event):
    Volume = Throttle.get()

Throttle = Scale(master, from_=0, to=100, tickinterval=10, length=200, orient=HORIZONTAL, command=getThrottle)
Throttle.set(0)
Throttle.pack()

mainloop()

我想知道的是如何同时制作两个程序 运行,同时在两个程序之间使用一个全局变量,该变量为 Volume

没关系,我发现了如何同时 运行 tkinter window 和音乐,但是一个新问题是 tkinter window 是空白的。

新问题是“Why is the tkinter window blank?