-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathselectBar.py
More file actions
59 lines (56 loc) · 1.52 KB
/
selectBar.py
File metadata and controls
59 lines (56 loc) · 1.52 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import pygame
from pygame import *
import sys
import TickBox
import textfield
from pygame.locals import *
import Image
import Button
class barItem( Button.button):
def __init__(self,surface,(posX,posY),kep):
self.tf1 = textfield.textField(surface,(30,50),(730,30),'',20)
self.tf2 = textfield.textField(surface,(250,105),(50,30),'',20)
self.x = posX
self.y = posY
self.canvas = surface
self.im = kep
self.img = pygame.image.load(kep)
self.dragging = 0
self.placed = False
self.selected = False
self.edit = False
self.b = TickBox.tickBox(surface,(400,152))
return
#return if the item is selected or not
def isSelected(self):
return self.selected
#if the item was clicked on the bar
def select(self):
self.selected = not self.selected
#place item
def place(self):
self.placed = True
return
#if the item was placed
def ifPlaced(self):
return self.placed
#dragging item
def setOne(self):
self.dragging = 1
#not dragging
def setZero(self):
self.dragging = 0
#changing coordinates
def setCoord(self,posX,posY):
self.x = posX
self.y = posY
def copy(self,image):
self.x = image.x
self.y = image.y
self.canvas = image.canvas
self.img = image.img
self.dragging = 0
return
#if the item is being dragged or not
def getStatus(self):
return self.dragging