jxwjq 发表于 2018-8-14 10:09:57

Python学习笔记-简单GUI开发

#filename:tkinter_1.py  
from tkinter import *
  
class App:
  
   def __init__(self,master):
  
      frame = Frame(master)
  
      frame.pack()
  

  
      self.hello = Button(frame, text="hello",
  
            command=self.hello)
  
      self.hello.pack(side=LEFT)
  

  
      self.quit = Button(frame, text="Quit", fg="red",
  
            command=frame.quit)
  
      self.quit.pack(side=RIGHT)
  
    def hello(self):
  
    print("Hello,world!")
  
root = Tk()
  
root.wm_title("hello")
  
root.wm_minsize(200,200)
  
app = App(root)
  
root.mainloop()
页: [1]
查看完整版本: Python学习笔记-简单GUI开发