如何在使用命令调用函数后禁用ttk按钮

时间:2017-04-14 22:16:21

标签: python python-3.x button tkinter ttk

这是我的代码段:

    def start1():
        global running, f
        running = True
        T1.configure(state="disabled")
        f = open("Test_1.txt", "w")
        recording() 

当我打电话给' start1'功能:

  #include <stdio.h>
  #include <stdlib.h>
  #include <unistd.h>
  #include <sys/wait.h>
  #include <math.h>

int main(int argc, char *argv[])
{

pid_t childpid;
int i, n;
if (argc != 2) {
    fprintf(stderr, "Usage: %s n\n", argv[0]); return 1;
}
n = atoi(argv[1]);
childpid=-1;
for (i = 1; i <= n; i++){

    int b;
    for(b=0;b<2;b++)
    {
        childpid=fork();
        if (childpid <= 0) break;

    }
    if (childpid > 0) break;

}
while(wait(NULL) > 0) ; /* wait for all of your children */


fprintf(stderr, "i:%d process ID:%ld parent ID:%ld child ID:%ld\n",i, (long)getpid(), (long)getppid(), (long)childpid);
return 0;
}

我总是收到以下错误消息:

  

Tkinter回调中的异常回溯(最近一次调用最后一次):文件   &#34; /usr/lib/python3.4/tkinter/ init .py&#34;,第1536行,在__call__return中   self.func(* args)File&#34; /home/pi/Public/Test_DataRecording.py" ;, line   40,在start1 T1.configure(state =&#34; disabled&#34;)AttributeError:   &#39; NoneType&#39;对象没有属性&#39; configure&#39;

不知何故T1不被识别为按钮...... 因为我是一个血腥的Python初学者,请注意你的答案

0 个答案:

没有答案