python tkinter,如何在单击一个按钮时运行两个命令?

如何单击一个按钮运行两个命令?


例子:

def commend1():

  print "hi"


def commend2():

  print "hello"


#TKinter

button = Button(root, commend= ?)

我希望它们同时运行


临摹微笑
浏览 125回答 2
2回答

至尊宝的传说

最基本的答案是:def commend1():  print "hi"def commend2():  print "hello"def cmd12():  commend1()  commend2()#TKinterbutton = Button(root, command=cmd12)

萧十郎

你可以让你的commended1() 像这样调用commend2():def commend1():  print "hi"  commend2()def commend2():  print "hello"#TKinterbutton = Button(root, command= commend1)
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python