This commit is contained in:
wangzz
2024-12-29 18:31:52 +08:00
commit c6cfb31d69
7 changed files with 400 additions and 0 deletions

25
script/ui.py Normal file
View File

@@ -0,0 +1,25 @@
import random
# 位置
class Point:
def __init__(self, x, y):
self.x = x
self.y = y
# 按纽
class Button:
def __init__(self, x, y, w = 0, h = 0):
self.x = x
self.y = y
self.w = w
self.h = h
def get_point(self, ran = True):
if ran == True and self.w > 0 and self.h > 0:
return Point(self.x + int(random.uniform(self.w * 4, self.w * 0.7)), self.y + int(random.uniform(self.h * 0.4, self.h * 0.7)))
else:
return Point(self.x, self.y)