import tkinter as tk
window = tk.Tk()
window.geometry("600x700")
window.title("xxx")
def people():
la["text"] = "我点"
def jie():
import pygame as p
import time
p.init()
screen = p.display.set_mode((682, 500))
p.display.set_caption("无限接球")
ballx = 100
bally = 150
ban_x, ban_y, ban_k, ban_g = 300, 460, 120, 40
p.key.set_repeat(100, 1)
ziti = p.font.Font(None, 30)
score = 0
while 1 > 0:
for sj in p.event.get():
if sj.type == p.QUIT:
p.quit()
elif sj.type == p.KEYDOWN:
if sj.key == p.K_RIGHT:
ban_x = ban_x + 10
elif sj.key == p.K_LEFT:
ban_x = ban_x - 10
elif sj.type == p.MOUSEMOTION:
ban_x, _ = sj.pos
screen.fill((120, 255, 30))
bally = bally + 1
if bally > 500:
bally = 0
ballx = ballx + 100
if ballx > 682:
ballx = 0
if ban_x < -50:
ban_x = 5
elif 682 < ban_x:
ban_x = 580
p.draw.circle(screen, (172, 85, 255), (ballx, bally), 10, 0)
p.draw.rect(screen, (172, 85, 255), (ban_x, ban_y, ban_k, ban_g), 0)
score = score + 1
text = ziti.render("score:%d" % score, True, (0, 0, 0))
screen.blit(text, (132, 436))
p.display.update()
la = tk.Label(
window,
font=(None, 30),
text="点赞人数",
bg="#B0E0E6",
fg="red",
width=10,
height=3,
)
la.pack()
btn = tk.Button(
window,
font=(None, 20),
text="点赞",
bg="#54FF9F",
fg="#000000",
command=people,
)
btn.pack()
bth = tk.Button(
window,
font = (None,20),
text = "揭小球游戏",
bg = "#54FF0A",
fg = "#010101",
command = jie,
)
bth.pack()
def duo():
import turtle as t
def face():
"""画脸"""
t.color("black")
t.fillcolor("blue")
t.begin_fill()
t.circle(150)
t.end_fill()
t.fillcolor("white")
t.begin_fill()
t.circle(120)
t.end_fill()
def eye():
t.up()
t.left(90)
t.fd(240)
t.down()
t.fillcolor("white")
t.begin_fill()
t.circle(30)
t.end_fill()
t.up()
t.left(90)
t.fd(16)
t.down()
t.dot(20)
t.up()
t.right(180)
t.fd(20)
t.down()
t.up()
t.right(90)
t.down()
t.fillcolor("white")
t.begin_fill()
t.circle(30)
t.end_fill()
t.up()
t.left(90)
t.fd(16)
t.down()
t.dot(20)
t.up()
t.right(180)
t.fd(28)
t.down()
def nose():
t.up()
t.goto(0, 220)
t.down()
t.fillcolor("red")
t.begin_fill()
t.circle(18)
t.end_fill()
def mouth():
t.up()
t.goto(0, 184)
t.down()
t.left(90)
t.fd(130)
t.left(90)
t.circle(110, 40)
t.speed(0)
face()
eye()
nose()
mouth()
t.done()
a = tk.Button(
window,
font = (None,20),
text = "多啦A梦",
bg = "#63FF0b",
fg = "#324242",
command = duo,
)
a.pack()
window.mainloop()
import tkinter as tk
window = tk.Tk()
window.geometry("1440x960")
window.title("xxx")
la = tk.Label(
window,
font=(None, 100),
text="你的电脑\n中毒了\n你的电脑\n中毒了",
bg="black",
fg="green",
width=400,
height=300,
)
la.pack()
window.mainloop()