国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網(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)遵守國家法律
渭源县| 松原市| 襄汾县| 建昌县| 平遥县| 南木林县| 沙湾县| 福贡县| 勃利县| 名山县| 平塘县| 嘉荫县| 京山县| 濮阳市| 长白| 昆明市| 海伦市| 综艺| 苍南县| 台北市| 若羌县| 香格里拉县| 封开县| 荥阳市| 胶南市| 聂拉木县| 东源县| 阿克陶县| 兖州市| 抚宁县| 富蕴县| 尉氏县| 兴安盟| 资中县| 天气| 湛江市| 通辽市| 渑池县| 宁城县| 乌拉特后旗| 阜新市|