def createWidget(self):
self.codeHoby=IntVar()#IntVar用来存数字
self.videoHOBY=IntVar()
print(self.codeHoby.get())#默认值是0
self.c1 = Checkbutton(self,text="敲代码"
,variable=self.codeHoby,onvalue=1,offvalue=0)
self.c2 = Checkbutton(self,text="看视频",
variable=self.videoHOBY,onvalue=1,offvalue=0)
self.c1.pack(side ="left");self.c2.pack(side = "left")#水平排布左对齐
Button(self,text="确认",command=self.confirm).pack(side="left")
def createWidget(self):
self.codeHoby=IntVar()#IntVar用来存数字
self.videoHOBY=IntVar()
print(self.codeHoby.get())#默认值是0
self.c1 = Checkbutton(root,text="敲代码"
,variable=self.codeHoby,onvalue=1,offvalue=0)
self.c2 = Checkbutton(root,text="看视频",
variable=self.videoHOBY,onvalue=1,offvalue=0)
self.c1.pack(side ="left");self.c2.pack(side = "left")#水平排布左对齐
Button(root,text="确认",command=self.confirm).pack(side="left")
老师 这里面的 root 和self 到底该怎么用啊 什么时候用 root 什么时候用self啊 我不是很理解

