[问题] 关于tkinter的输入问题

楼主: jack622 (High)   2017-09-12 12:12:23
小弟的部分程式码如下
def DG(degree):
move_to_absolute_degree(degree)
def get_current_pos_degree():
x.cco(0,5)
return val2deg(x.gco(0,5))
def print_cur_pos_deg():
cur_pos_deg = get_current_pos_degree()
print(cur_pos_deg)
#GUI
from Tkinter import *
win=Tk()
win.title("TurnTable GUI")
frame=Frame(win)
frame.grid(column=0,row=0)
label1=Label(win, text="Device Information :")
label1.grid(column=0,row=0,sticky=W)
label2=Label(win,bg="white",width=50,height=5)
label2.grid(column=0,row=1)
label3=Label(win,bg="black",width=50,height=10)
label3.grid(column=0,row=2)
entry1=Entry(win)
entry1.grid(column=0,row=4)
entry1.get()
button1=Button(win, text="OK")
button1.grid(column=0,row=5)
win.mainloop()
我想达成在entry1输入DG(30),然后按下OK按钮
就可以有在Command Line输入DG(30)的效果
简单讲就是把GUI跟程式结合起来XD
上网爬了很久都找不到解法,还请各位大大指导,谢谢。
作者: s860134 (s860134)   2017-09-26 02:04:00
https://www.tutorialspoint.com/python/tk_button.htm这个范例拿去改一改就满足了

Links booklink

Contact Us: admin [ a t ] ucptt.com