-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbuttons.py
More file actions
44 lines (34 loc) · 770 Bytes
/
Copy pathbuttons.py
File metadata and controls
44 lines (34 loc) · 770 Bytes
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 Button(object):
def __init__(self, width, height, x, y):
self._width, self._height = width, height
self._x, self._y = x, y
@property
def x(self):
return self._x
@property
def y(self):
return self._y
@property
def width(self):
return self._width
@property
def height(self):
return self._height
class Buttons(dict):
def __init__(self, num_keys, width, height):
self._width, self._height = width, height
self._num_keys = num_keys
@property
def num_keys(self):
return self._num_keys
@property
def width(self):
return self._width
@property
def height(self):
return self._height
@property
def nos(self):
return list(self.keys())
def add_button(self, no, width, height, x, y):
self[no] = Button(width, height, x, y)