我创建了两个函数来更改应用程序的主题。以下是一些例子:
def redtheme():
text.config(background="light salmon", foreground="red",
insertbackground="red")
def greentheme():
text.config(background="pale green", foreground="dark green",
insertbackground="dark green")
def bluetheme():
text.config(background="light blue", foreground="dark blue",
insertbackground="blue")
(text是文本小部件的名称)
我想创建一个函数,使这些函数中的任意一个在应用程序启动时运行。
换句话说,我想要一个在应用程序启动时执行的函数,该函数将从random.choice()
中选择一个函数并执行该函数:
full = (redtheme, greentheme, bluetheme)
selected = random.choice(full)
# here, it could be text.config(full)?? or what?
如何使应用程序在启动时执行三个函数中的一个
目前没有回答
相关问题 更多 >
编程相关推荐