天下程序员首页cx06.com
管理 |  登录 |  注册
Checkbutton的写法(与Radio写法相似)
更新于:2024-07-30

Checkbutton的写法(与Radio写法相似)

只是,多了两个特别的参数

onvalue 选中的值

offvalue 未选中的值

        self.co=IntVar()
        self.vi=IntVar()
        print(self.co.get())
        self.r1=Checkbutton(self,text="写代码",variable=self.co,onvalue=1,offvalue=0)
        self.r2=Checkbutton(self,text="听歌",variable=self.vi,onvalue=1,offvalue=0)
        self.r1.pack();self.r2.pack()
天下程序员 www.cx06.com 程序员的网上家园!
作者微信:13126507001