|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 MIke_python小小 于 2020-5-1 13:43 编辑
最近写了一个tkinter小程序
这个应用是你只要把鼠标移动到button里button就会跑
有一定几率传送到鼠标底下
虽然不好玩 但是凑活玩吧
上代码:
- from tkinter import *
- from tkinter import messagebox as g
- import random
- root = Tk()
- root.title('你点不找')
- root.geometry('250x250')
- def win():
- g.showinfo('', '你居然点着了, 嘻嘻')
- def enter(ev = None):
- global place_x, place_y
- for i in range(2):
- place_x = random.randint(0, 200)
- place_y = random.randint(0, 200)
- a.place(x=place_x, y=place_y)
- a = Button(root, text='你点不找', command=win)
- a.place(x=1, y=1)
- a.bind("<Enter>", enter)
- root.mainloop()
复制代码
上截图:
记得点评呀
|
评分
-
查看全部评分
|