点击了python和一些按钮后,会产生一些颜色变化的按钮
当单击按钮时,是否可以更改按钮使用的.gif?我希望它在GPIO引脚关闭时显示ON,在GPIO引脚打开时显示off。在
目前我有:#BCM17
GPIO.setup(17,GPIO.OUT)
colour17=StringVar()
pinstate17=GPIO.input(17)
if pinstate17==1:
colour17.set('red')
else:
colour17.set('green')
BCM17Bimage=tk.PhotoImage(file='on.gif')
BCM17B = Button(clock, text="GPIO 0\nBCM 17", image=BCM17Bimage, width=78, height=100, bg="grey", command=BCM17f).grid(column=2, row=1)
BCM17L = Label(clock, text="GPIO 0\nBCM 17", font=(fontname,12), fg='white', bg=colour17.get(), width=10, height=2)
BCM17L.grid(column=0, row=1)
按钮的定义是:
^{pr2}$
一个随机的旁白-有没有可能收到一封电子邮件,当人们在这里回复一个帖子?有一个很好的外观,但看不到任何地方的选择。在