資源簡介
需要安裝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(“用戶界面“)
????#添加一個多選按鈕和單選按鈕到frame1
????????‘‘‘
????????frame1?=?frame(window)
????????frame1.pack()??#看下面的解釋(包管理器)
????????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的網格第一行第一列(網格管理器也會在下面有解釋)
????????rbRed.grid(row=1?column=2)
????????rbYellow.grid(row=1?column=3)
????????‘‘‘
????#添加一個label、entry、button和message到frame2
????????frame2?=?frame(window)
????????frame2.pack()
????????label?=?Label(frame2?text?=?“請輸入IP“)
????????#label2?=?Label(frame2?text=“端口“)
????????label3?=?Label(frame2?text=“機架號“)
????????label4=?Label(frame
- 上一篇:python實現 時鐘(基于turtle)
- 下一篇:遺傳算法解決 TSP 問題
評論
共有 條評論