五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

tkinter.Checkbutton學(xué)習(xí)筆記

2021-09-13 21:28 作者:灰色de世界  | 我要投稿

import tkinter
from tkinter import IntVar, Checkbutton, Label, StringVar

# 內(nèi)容:checkbutton多選框


class MainForm():
? ?def __init__(self):
? ? ? ?# 設(shè)置一個(gè)頁面
? ? ? ?self.root = tkinter.Tk()
? ? ? ?# 設(shè)置頁面總標(biāo)題
? ? ? ?self.root.title('啦啦啦專屬')
? ? ? ?# 設(shè)置logo圖標(biāo),格式為 .ico
? ? ? ?self.root.iconbitmap(r'OIP-C.ico')
? ? ? ?# 獲得屏幕寬度
? ? ? ?self.screen_width = self.root.winfo_screenwidth()
? ? ? ?self.screen_height = self.root.winfo_screenheight()
? ? ? ?x = (self.screen_width - 360) / 2
? ? ? ?y = (self.screen_height - 220) / 2
? ? ? ?# 設(shè)置居中窗口
? ? ? ?self.root.geometry("360x220+%d+%d" % (x, y))
? ? ? ?# self.root.geometry('360x220')
? ? ? ?# 禁止修改窗口(固定初始化窗口)
? ? ? ?self.root.resizable(width=0, height=0)
? ? ? ?# 設(shè)置背景顏色
? ? ? ?# self.root["background"] = "orange"
? ? ? ?self.data_list = [("魔道祖師", IntVar()), ("靈籠", IntVar()),
? ? ? ? ? ? ? ? ? ? ? ? ?("百妖譜", IntVar()), ("暗夜神使", IntVar()),
? ? ? ? ? ? ? ? ? ? ? ? ?("月光下的異世界之旅", IntVar()), ("萬國志", IntVar())]
? ? ? ?self.label = Label(self.root, text="請(qǐng)選擇你喜歡的動(dòng)漫:",
? ? ? ? ? ? ? ? ? ? ? ? ? font=("微軟雅黑", 12))
? ? ? ?self.label.pack(anchor="w")
? ? ? ?for title, status in self.data_list:
? ? ? ? ? ?self.check = Checkbutton(self.root, text=title,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? onvalue=1, offvalue=0,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? variable=status,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? command=self.function)
? ? ? ? ? ?self.check.pack(anchor="w")
? ? ? ?# 設(shè)置默認(rèn)選項(xiàng)
? ? ? ?self.data_list[5][1].set(1)
? ? ? ?# 禁止修改
? ? ? ?self.check["state"] = "disable"
? ? ? ?self.content = StringVar()
? ? ? ?self.label_fa = Label(self.root, textvariable=self.content,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?font=('微軟雅黑', 10))
? ? ? ?self.label_fa.pack(anchor="w")
? ? ? ?# 顯示頁面
? ? ? ?self.root.mainloop()

? ?def function(self):
? ? ? ?result = "你喜歡的動(dòng)漫有:"
? ? ? ?for title, status in self.data_list:
? ? ? ? ? ?if status.get() == 1:
? ? ? ? ? ? ? ?result += title + "、"
? ? ? ?self.content.set(result)


def main():
? ?MainForm()


if __name__ == '__main__':
? ?main()



運(yùn)行結(jié)果


checkbutton參數(shù)


tkinter.Checkbutton學(xué)習(xí)筆記的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國家法律
昆明市| 万宁市| 大同县| 苏尼特左旗| 二连浩特市| 贵港市| 张家界市| 曲阜市| 句容市| 隆安县| 安阳县| 高淳县| 永定县| 夏津县| 勃利县| 长丰县| 长兴县| 进贤县| 金门县| 永州市| 乌兰察布市| 新田县| 遂宁市| 盖州市| 大英县| 习水县| 兴安盟| 江川县| 清水河县| 余姚市| 垣曲县| 衡山县| 商水县| 三明市| 乐亭县| 聊城市| 仁布县| 乌拉特前旗| 博白县| 奎屯市| 宝应县|