py脚本
This commit is contained in:
25
script/ui.py
Normal file
25
script/ui.py
Normal 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)
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user