我想显示更新tkinter canvas实时

时间:2017-04-20 04:35:58

标签: python tkinter raspberry-pi tkinter-canvas

我尝试在文本更新1之后不更新文本

        <key>UISupportedInterfaceOrientations~ipad</key>
        <array> 
            <string>UIInterfaceOrientationLandscapeLeft</string>
            <string>UIInterfaceOrientationLandscapeRight</string>
        </array>

显示文字节目

def main_ai():
    master = Tk()
    master.wm_attributes('-fullscreen','true')
    master.title("Reverse vending")
    canvas = Canvas(master, width=1280, height=1024)
    canvas.pack()

更改文字很糟糕

def check(canvas,master):
  w_b=0
  text_id=canvas.create_text(740, 470, text=0,font=("Sukhumvit set",70),fill="white")
  text_ig=canvas.create_text(740, 690, text=0.0,font=("Sukhumvit set",70),fill="white")
  #master.after(1000,lambda:master.destroy())
  #master.mainloop()
  while True:
      if check_fullbottle()==500: #check total number of bottles 
          break
      master.after(1000,check_distance())
      w_b+=1

    master.after(2000,lambda:changetext(text_id,text_ig,w_b,canvas,master))
    #master.after(3000,lambda:master.destroy())
    master.after(1000,check_button(w_b,master))
    end_loop(w_b,master)
 master.mainloop()
 return w_b

它显示'Nonetype'对象没有属性'update'。

文字显示很糟糕

def change_text(text_id,text_ig,w_b,canvas,master):
  canvas.itemconfig(text_id,text=w_b).update()
  canvas.itemconfig(text_ig,text=w_b*0.1).update()

显示'int'对象没有属性'pack'

感谢您的帮助

0 个答案:

没有答案