xinxin - 初步学习tkinter

import tkinter
import time
# 初始化
mywindow = tkinter.Tk()
# 设置标题 title
mywindow.title("wxx")
# 设置大小
mywindow.geometry("500x600")
# 设置一个标签   label
a = 1
def dian():
    global a
    a = a + 1
    la['text'] = "点赞人数%d"%a


la = tkinter.Label(
    mywindow,
    text="点赞人数",
    bg="#9ACD32",  # bg background
    fg="black",  # front ground
    font = ("None 30 bold"),
    width = 10,
    height = 5,
    bd = 10
)
# 把标签放到窗口上
la.pack()
# 按钮  button
btn = tkinter.Button(
    mywindow,
    text = "点赞",
    bg = "black",
    fg = "pink",
    font = ("None 20 bold"),
    width = 5,
    height = 3,
    bd =10,
    command = dian
)
btn.pack()



# 循环显示我们的窗口
mywindow.mainloop()
import tkinter

chuangkou = tkinter.Tk()
chuangkou.title("hls")
chuangkou.geometry("1600x1200")
la = tkinter.Label(
    chuangkou,
    text="你的电脑中病毒了",
    bg="black",
    fg="#00FF7F",
    font = ('None 100 bold'),
    width = 100,
    height = 50,
    bd = 10,
)
la.pack()
chuangkou.mainloop()
发布了390 篇原创文章 · 获赞 19 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/houlaos/article/details/104483807