-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbar.py
More file actions
39 lines (33 loc) · 1009 Bytes
/
bar.py
File metadata and controls
39 lines (33 loc) · 1009 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
import pygame
class Bar():
# Preferences:
color = (139,225,148)
smoothness_of_bar = 20
# define bar y size by 1/n of the screen
define_bar_y_size_by = 20
def __init__(self, window):
self.window = window
self.bar_y_size = (window.get_height()/
self.define_bar_y_size_by)
self.pointer_pos = self.pointer_x, self.pointer_y = (
-(window.get_width()),
((window.get_height())-self.bar_y_size)
)
size = (
(self.window.get_width()),
(self.window.get_height())
)
self.size = self.width, self.height = size
def draw(self, add_value):
pygame.draw.rect(
self.window,
self.color,
(
self.pointer_x,
self.pointer_y,
self.width,
self.height
)
)
if self.pointer_x < 0:
self.pointer_x += add_value