python GUIDEMO

2021-12-13  本文已影响0人  jinhm007

from tkinter import *

class MainWindow:
 def __init__(self):
     self.frame = Tk()
     self.label_name = Label(self.frame, text="name:")
     self.label_age = Label(self.frame, text="age:")
     self.text_name = Text(self.frame, height="1", width=30)
     self.text_age = Text(self.frame, height="1", width=30)
     self.label_name.grid(row=0, column=0)
     self.label_age.grid(row=1, column=0)
     self.button_ok = Button(self.frame, text="ok", width=10)
     self.button_cancel = Button(self.frame, text="cancel", width=10)
     self.text_name.grid(row=0, column=1)
     self.text_age.grid(row=1, column=1)
     self.button_ok.grid(row=3, column=0)
     self.button_cancel.grid(row=3, column=1)
     self.frame.mainloop()


frame = MainWindow()
上一篇下一篇

猜你喜欢

热点阅读