-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWidgets.py
More file actions
44 lines (36 loc) · 1.51 KB
/
Copy pathWidgets.py
File metadata and controls
44 lines (36 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#放置 基类
class Compos():
def pack(self,direction):
self.direction = direction
self.console.widgets[self.number][2] = [self.direction]
self.console.blit()
def place(self,x,y=0):
self.x = x
self.y = y
self.console.widgets[self.number][2] = [x,y]
self.console.blit()
def configure(self,console,widget,config,var):
self.console.widgets[widget.number][1][str(config)] = var
class HrefLine(Compos):
"""分割线"""
def __init__(self,console):
self.console = console
self.number = len(self.console.widgets)
self.console.widgets.append(["HrefLine",{},[0,0]])
class Button(Compos):
def __init__(self,console,text="",func=None):
self.text,self.func = text,func
self.console = console
self.number = len(self.console.widgets)
self.console.widgets.append(["Button",
{"text":text,"function":func},
[0,0]])
class Label(Compos):
"""文字"""
def __init__(self,console,fill="",width=0,height=0,text="hello"):
self.fill, self.width, self.height, self.text= fill, width, height, text
self.console = console
self.number = len(self.console.widgets)
self.console.widgets.append(["Label",
{"fill":self.fill,"width":self.width,"height":self.height,"text":self.text},
[0,0]])