This article mainly introduces Python Notepad based on Tkinter. The example analyzes the related skills of Tkinter to implement the notepad program. if you need it, refer to the example in this article to describe Python Notepad based on Tkinter. Share it with you for your reference. The details are as follows:
From Tkinter import * root = Tk ('simple editor') mi = StringVar () Label (text = 'Please input something you like ~ '). Pack () te = Text (height = 30,width = 100) te. pack () Label (text = 'File name '). pack (side = LEFT) Entry (textvariable = mi ). pack (side = LEFT) mi. set ('*. txt ') def save (): t = te. get ('0. 0', '10. 0 ') f = open (mi. get (), 'w') f. write (t) Button (text = 'save', command = Save ). pack (side = RIGHT) Button (text = 'exit ', command = root. quit ). pack (side = RIGHT) mainloop ()
I hope this article will help you with Python programming.