2017年10月1日 星期日

Tkinter Text Entry 输入多行本文

Tkinter Text Entry 输入多行本文




from tkinter import *
import tkinter as tk
class myapp(tk.Tk):
    def __init__(self):
        tk.Tk.__init__(self)
        self.text=tk.Text(self)
        self.button=tk.Button(self,text='save',command=self.on_button)
        self.button1=tk.Button(self,text='quit',command=quit)
        self.button.pack()
        self.button1.pack()
        self.text.pack()
    def on_button(self):
        mydiary=open('mydiary.txt','a')
        mydiary.write(self.text.get(1.0,END)+'\n')
        mydiary.close()

app=myapp()
app.mainloop()


沒有留言:

張貼留言

Node-Red --> MQTT --> Fuxa

Node-Red --> MQTT --> Fuxa      FUXA(一個開源的 Web HMI / SCADA 自動化監控軟體)的專案設定檔 。 這份設定檔完整定義了 HMI 監控畫面的 後端通訊(MQTT 連線、點位標籤) 與 前端網頁圖形介面(SVG 畫布...