Ai
1 Star 3 Fork 4

lgp/python pycharm tkinter

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
44 Checkbox.py 850 Bytes
一键复制 编辑 原始数据 按行查看 历史
lgp 提交于 2021-12-25 15:26 +08:00 . 新增加例子至 47个, 采用类 写代码
import tkinter as tk
from tkinter import messagebox
class application(tk.Frame):
def __init__(self,mast=None):
self.master=mast
super().__init__()
self.creatAPP()
def creatAPP(self):
self.music=tk.IntVar()
self.sport=tk.IntVar()
l1=tk.Label(self.master,text='hobby').pack(side='left')
c1=tk.Checkbutton(self.master,text='音乐',variable=self.music,onvalue=1,offvalue=0).pack(side='left')
c2=tk.Checkbutton(self.master,text='运动',variable=self.sport,onvalue=1,offvalue=0).pack(side='left')
b1=tk.Button(self.master,text='submit',command=self.pt).pack(side='left')
def pt(self):
messagebox.showinfo('爱好',f'爱好music={self.music.get()},sport={self.sport.get()}')
window=tk.Tk()
window.geometry('500x80')
app=application(window)
window.mainloop()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/tdxliguiping/python-pycharm-tkinter.git
git@gitee.com:tdxliguiping/python-pycharm-tkinter.git
tdxliguiping
python-pycharm-tkinter
python pycharm tkinter
master

搜索帮助