資源簡(jiǎn)介
需要安裝snap7,命令: pip install python-snap7
代碼片段和文件信息
#!/bin/python
#encoding=utf8
from?tkinter?import?*
import?snap7
from?functools?import?reduce
class?WidgetsDemo:
????def?__init__(self):
????????window?=?Tk()
????????window.title(“用戶界面“)
????#添加一個(gè)多選按鈕和單選按鈕到frame1
????????‘‘‘
????????frame1?=?frame(window)
????????frame1.pack()??#看下面的解釋?zhuān)ò芾砥鳎?br/>
????????self.v2?=?IntVar()
????????rbRed?=?Radiobutton(frame1?text?=?“紅色“?bg?=?“red“?variable?=?self.v2?value?=?1?command?=?self.processRaidobutton)
????????rbYellow?=?Radiobutton(frame1?text=“黃色“?bg=“yellow“?variable=self.v2?value=2?command=self.processRaidobutton)
?????????#將cbtBold排列在frame1的網(wǎng)格第一行第一列(網(wǎng)格管理器也會(huì)在下面有解釋?zhuān)?br/>????????rbRed.grid(row=1?column=2)
????????rbYellow.grid(row=1?column=3)
????????‘‘‘
????#添加一個(gè)label、entry、button和message到frame2
????????frame2?=?frame(window)
????????frame2.pack()
????????label?=?Label(frame2?text?=?“請(qǐng)輸入IP“)
????????#label2?=?Label(frame2?text=“端口“)
????????label3?=?Label(frame2?text=“機(jī)架號(hào)“)
????????label4=?Label(frame
評(píng)論
共有 條評(píng)論