简体   繁体   English

使用Tkinter在按钮中传递两种不同的功能

[英]Passing two different functions in a button using Tkinter

I am trying to create a GUI with Python's Tkinter for some scripts and misc functions I have, the design of the GUI looks something like this: 我正在尝试使用Python的Tkinter为我拥有的某些脚本和其他功能创建GUI,该GUI的设计如下所示:

Then, as the label says, I would like to transform a directory full of documents to a single .csv file, so I created two functions: My question is: How should I merge the two functions in the GUI's code?. 然后,如标签所示,我想将一个充满文档的目录转换为单个.csv文件,因此我创建了两个函数:我的问题是:我应该如何在GUI代码中合并这两个函数? I tried with a function that calls the two aforementioned functions, however, It did not work. 我尝试了使用调用上述两个函数的函数,但是,该函数不起作用。 I would also like to know if there is a better way to achieve this. 我也想知道是否有更好的方法来实现这一目标。

As mentioned by @Brian Oakley, why haven't you tried including the two functions under 1, in this case, instead of configuring your button on click_me, include maybe the 2 other functions you mentioned? 正如@Brian Oakley所提到的,为什么您没有尝试在1下包括这两个功能,而不是在click_me上配置按钮,而可能还包括您提到的其他两个功能?

def clickMe():

    action.configure(text='Hello ' + input_directory.get())
    retrive(input_directory.get())
    corpus_writer(output_directory.get())

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM