import tkinter as tk
class Windows():
def __init__(self,mytk):
self.window = mytk
self.initWindowMySelf()
self.initWindowConfigInfo()
#初始化窗口自身属性
def initWindowMySelf(self):
#禁用窗口最大化操作
self.window.resizable(False, False)
# 窗口标题
self.window.title('ihelp组件检查小助手')
# 设置窗口大小
self.window.geometry('800x480+400+300')
#初始化窗口配置信息
def initWindowConfigInfo(self):
self.screenshot_var = tk.IntVar()
self.screenshot_var.set(1)
# 截图设置
screenshot_config = tk.Checkbutton(self.window, text='是否截图', font=('Arial', 12), width=8, height=1,variable=self.screenshot_var, command=self.listenScreenshotConfig)
screenshot_config.place(x=10, y=10)
#监听截图配置勾选
def listenScreenshotConfig(self):
print(self.screenshot_var.get())
if __name__ == '__main__':
# 创建主窗口对象
mytk = tk.Tk()
app = Windows(mytk)
app.window.mainloop()