Merge branch 'master' into neural_networks
# Conflicts: # .gitignore # algorithms/learn/decision_tree/decision_tree.py
This commit is contained in:
commit
5ab0f21a84
@ -40,12 +40,12 @@ class DecisionTree:
|
|||||||
print(tree.export_text(self.clf, feature_names=self.vec.get_feature_names()))
|
print(tree.export_text(self.clf, feature_names=self.vec.get_feature_names()))
|
||||||
|
|
||||||
# plot a tree (not necessary)
|
# plot a tree (not necessary)
|
||||||
fig = pyplot.figure(figsize=(50, 40))
|
# fig = pyplot.figure(figsize=(50, 40))
|
||||||
_ = tree.plot_tree(self.clf,
|
# _ = tree.plot_tree(self.clf,
|
||||||
feature_names=self.vec.get_feature_names(),
|
# feature_names=self.vec.get_feature_names(),
|
||||||
class_names=self.clf.classes_,
|
# class_names=self.clf.classes_,
|
||||||
filled=True)
|
# filled=True)
|
||||||
fig.savefig("decistion_tree.png")
|
# fig.savefig("decistion_tree.png")
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
dump(self.clf, 'decision_tree.joblib')
|
dump(self.clf, 'decision_tree.joblib')
|
||||||
@ -87,4 +87,5 @@ if __name__ == "__main__":
|
|||||||
# generate_data("training_set.txt", 12000)
|
# generate_data("training_set.txt", 12000)
|
||||||
decision_tree = DecisionTree()
|
decision_tree = DecisionTree()
|
||||||
decision_tree.build("training_set.txt", 15)
|
decision_tree.build("training_set.txt", 15)
|
||||||
|
decision_tree.test()
|
||||||
decision_tree.save()
|
decision_tree.save()
|
||||||
|
0
disarm_popup/__init__.py
Normal file
0
disarm_popup/__init__.py
Normal file
550
disarm_popup/popup.py
Normal file
550
disarm_popup/popup.py
Normal file
@ -0,0 +1,550 @@
|
|||||||
|
import pygame
|
||||||
|
import pygame_gui
|
||||||
|
from project_constants import SCREEN_WIDTH, SCREEN_HEIGHT, V_NAME_OF_WINDOW
|
||||||
|
from assets.asset_constants import ASSET_CONCRETE
|
||||||
|
|
||||||
|
|
||||||
|
# =========== #
|
||||||
|
# == const == #
|
||||||
|
# =========== #
|
||||||
|
|
||||||
|
# main heights and lengths
|
||||||
|
gap_main = 20
|
||||||
|
gap_elem = 10
|
||||||
|
height_label = 24
|
||||||
|
height_cable_double_label = 2 * height_label + gap_elem
|
||||||
|
length_param_desc = 120
|
||||||
|
length_param_values = 250
|
||||||
|
length_cables = 250
|
||||||
|
# main heights and lengths
|
||||||
|
|
||||||
|
# frame, image and image labels
|
||||||
|
length_frame = length_param_desc + gap_elem + length_param_values + 3 * gap_main + length_cables
|
||||||
|
length_image = int((length_frame - 3 * gap_main) / 2)
|
||||||
|
height_image = length_image
|
||||||
|
height_frame = 6 * height_label + 5 * gap_elem + height_image + 2 * height_label + 2 * gap_elem + 3 * gap_main
|
||||||
|
screen_size = (int(length_frame), int(height_frame))
|
||||||
|
length_label_image = int((length_image - gap_elem) / 2)
|
||||||
|
# frame, image and image labels
|
||||||
|
|
||||||
|
# sizes
|
||||||
|
size_label_param_desc = (length_param_desc, height_label)
|
||||||
|
size_label_param_values = (length_param_values, height_label)
|
||||||
|
size_cable_label = (length_cables, height_label)
|
||||||
|
size_cable = (length_cables, height_cable_double_label)
|
||||||
|
size_image = (length_image, height_image)
|
||||||
|
size_light = (height_label, height_label)
|
||||||
|
size_label_image = (length_label_image, height_label)
|
||||||
|
# sizes
|
||||||
|
|
||||||
|
# y's
|
||||||
|
y_params1 = y_cables_label1 \
|
||||||
|
= gap_main
|
||||||
|
y_params2 = y_cable1 \
|
||||||
|
= y_params1 + gap_elem + height_label
|
||||||
|
y_params3 = y_params2 + gap_elem + height_label
|
||||||
|
y_params4 = y_cables_label2 \
|
||||||
|
= y_params3 + gap_elem + height_label
|
||||||
|
y_params5 = y_cable2 \
|
||||||
|
= y_params4 + gap_elem + height_label
|
||||||
|
y_params6 = y_params5 + gap_elem + height_label
|
||||||
|
y_image = y_params6 + gap_main + height_label
|
||||||
|
y_image_label1 = y_image + height_image + gap_elem
|
||||||
|
y_image_label2 = y_image_label1 + height_label + gap_elem
|
||||||
|
# y's
|
||||||
|
|
||||||
|
# x's
|
||||||
|
x_param_desc = x_image1 = x_image1_label1 \
|
||||||
|
= gap_main
|
||||||
|
x_image1_label2 = x_image1_label1 + length_label_image + gap_elem
|
||||||
|
x_param_values = x_param_desc + length_param_desc + gap_elem
|
||||||
|
x_param_values_after_light = x_param_values + gap_elem
|
||||||
|
x_cables = x_param_values + length_param_values + gap_main
|
||||||
|
x_image2 = x_image2_label1\
|
||||||
|
= x_image1 + length_image + gap_main
|
||||||
|
x_image2_label2 = x_image2_label1 + length_label_image + gap_elem
|
||||||
|
# x's
|
||||||
|
|
||||||
|
|
||||||
|
# =========== #
|
||||||
|
# == class == #
|
||||||
|
# =========== #
|
||||||
|
|
||||||
|
class SampleWindow:
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
|
||||||
|
# main attributes
|
||||||
|
self.running = True
|
||||||
|
self.clock = pygame.time.Clock()
|
||||||
|
self.manager = pygame_gui.UIManager(screen_size, 'theme.json') # TODO : change theme path
|
||||||
|
# main attributes
|
||||||
|
|
||||||
|
def gui():
|
||||||
|
|
||||||
|
def params_desc():
|
||||||
|
pygame_gui.elements.UILabel(
|
||||||
|
relative_rect=pygame.Rect(
|
||||||
|
(x_param_desc, y_params1),
|
||||||
|
size_label_param_desc
|
||||||
|
),
|
||||||
|
text="TYPE",
|
||||||
|
manager=self.manager,
|
||||||
|
object_id="description"
|
||||||
|
)
|
||||||
|
pygame_gui.elements.UILabel(
|
||||||
|
relative_rect=pygame.Rect(
|
||||||
|
(x_param_desc, y_params2),
|
||||||
|
size_label_param_desc
|
||||||
|
),
|
||||||
|
text="DANGER CLASS",
|
||||||
|
manager=self.manager,
|
||||||
|
object_id="description"
|
||||||
|
)
|
||||||
|
pygame_gui.elements.UILabel(
|
||||||
|
relative_rect=pygame.Rect(
|
||||||
|
(x_param_desc, y_params3),
|
||||||
|
size_label_param_desc
|
||||||
|
),
|
||||||
|
text="INDICATOR",
|
||||||
|
manager=self.manager,
|
||||||
|
object_id="description"
|
||||||
|
)
|
||||||
|
pygame_gui.elements.UILabel(
|
||||||
|
relative_rect=pygame.Rect(
|
||||||
|
(x_param_desc, y_params4),
|
||||||
|
size_label_param_desc
|
||||||
|
),
|
||||||
|
text="WEIGHT",
|
||||||
|
manager=self.manager,
|
||||||
|
object_id="description"
|
||||||
|
)
|
||||||
|
pygame_gui.elements.UILabel(
|
||||||
|
relative_rect=pygame.Rect(
|
||||||
|
(x_param_desc, y_params5),
|
||||||
|
size_label_param_desc
|
||||||
|
),
|
||||||
|
text="SERIES",
|
||||||
|
manager=self.manager,
|
||||||
|
object_id="description"
|
||||||
|
)
|
||||||
|
pygame_gui.elements.UILabel(
|
||||||
|
relative_rect=pygame.Rect(
|
||||||
|
(x_param_desc, y_params6),
|
||||||
|
size_label_param_desc
|
||||||
|
),
|
||||||
|
text="SPECIFICITY",
|
||||||
|
manager=self.manager,
|
||||||
|
object_id="description"
|
||||||
|
)
|
||||||
|
|
||||||
|
def params_values():
|
||||||
|
# type value
|
||||||
|
pygame_gui.elements.UILabel(
|
||||||
|
relative_rect=pygame.Rect(
|
||||||
|
(x_param_values, y_params1),
|
||||||
|
size_label_param_values
|
||||||
|
),
|
||||||
|
text="...",
|
||||||
|
manager=self.manager,
|
||||||
|
object_id="empty_field"
|
||||||
|
)
|
||||||
|
# danger class value
|
||||||
|
pygame_gui.elements.UILabel(
|
||||||
|
relative_rect=pygame.Rect(
|
||||||
|
(x_param_values, y_params2),
|
||||||
|
size_label_param_values
|
||||||
|
),
|
||||||
|
text="...",
|
||||||
|
manager=self.manager,
|
||||||
|
object_id="empty_field"
|
||||||
|
)
|
||||||
|
# indicator value
|
||||||
|
pygame_gui.elements.UILabel(
|
||||||
|
relative_rect=pygame.Rect(
|
||||||
|
(x_param_values, y_params3),
|
||||||
|
size_label_param_values
|
||||||
|
),
|
||||||
|
text="...",
|
||||||
|
manager=self.manager,
|
||||||
|
object_id="empty_field"
|
||||||
|
)
|
||||||
|
# weight value
|
||||||
|
pygame_gui.elements.UILabel(
|
||||||
|
relative_rect=pygame.Rect(
|
||||||
|
(x_param_values, y_params4),
|
||||||
|
size_label_param_values
|
||||||
|
),
|
||||||
|
text="...",
|
||||||
|
manager=self.manager,
|
||||||
|
object_id="empty_field"
|
||||||
|
)
|
||||||
|
# series value
|
||||||
|
pygame_gui.elements.UILabel(
|
||||||
|
relative_rect=pygame.Rect(
|
||||||
|
(x_param_values, y_params5),
|
||||||
|
size_label_param_values
|
||||||
|
),
|
||||||
|
text="...",
|
||||||
|
manager=self.manager,
|
||||||
|
object_id="empty_field"
|
||||||
|
)
|
||||||
|
# spec value
|
||||||
|
pygame_gui.elements.UILabel(
|
||||||
|
relative_rect=pygame.Rect(
|
||||||
|
(x_param_values, y_params6),
|
||||||
|
size_label_param_values
|
||||||
|
),
|
||||||
|
text="...",
|
||||||
|
manager=self.manager,
|
||||||
|
object_id="empty_field"
|
||||||
|
)
|
||||||
|
|
||||||
|
def cables():
|
||||||
|
pygame_gui.elements.UILabel(
|
||||||
|
relative_rect=pygame.Rect(
|
||||||
|
(x_cables, y_cables_label1),
|
||||||
|
size_cable_label
|
||||||
|
),
|
||||||
|
text="CORRECT CABLE",
|
||||||
|
manager=self.manager,
|
||||||
|
object_id="description"
|
||||||
|
)
|
||||||
|
pygame_gui.elements.UILabel(
|
||||||
|
relative_rect=pygame.Rect(
|
||||||
|
(x_cables, y_cables_label2),
|
||||||
|
size_cable_label
|
||||||
|
),
|
||||||
|
text="CHOSEN CABLE",
|
||||||
|
manager=self.manager,
|
||||||
|
object_id="description"
|
||||||
|
)
|
||||||
|
pygame_gui.elements.UILabel(
|
||||||
|
relative_rect=pygame.Rect(
|
||||||
|
(x_cables, y_cable1),
|
||||||
|
size_cable
|
||||||
|
),
|
||||||
|
text="...",
|
||||||
|
manager=self.manager,
|
||||||
|
object_id="empty_field"
|
||||||
|
)
|
||||||
|
pygame_gui.elements.UILabel(
|
||||||
|
relative_rect=pygame.Rect(
|
||||||
|
(x_cables, y_cable2),
|
||||||
|
size_cable
|
||||||
|
),
|
||||||
|
text="...",
|
||||||
|
manager=self.manager,
|
||||||
|
object_id="empty_field"
|
||||||
|
)
|
||||||
|
|
||||||
|
def image1():
|
||||||
|
pygame_gui.elements.UILabel(
|
||||||
|
relative_rect=pygame.Rect(
|
||||||
|
(x_image1_label1, y_image_label1),
|
||||||
|
size_label_image
|
||||||
|
),
|
||||||
|
text="CORRECT SERIES",
|
||||||
|
manager=self.manager,
|
||||||
|
object_id="description"
|
||||||
|
)
|
||||||
|
# correct series value
|
||||||
|
pygame_gui.elements.UILabel(
|
||||||
|
relative_rect=pygame.Rect(
|
||||||
|
(x_image1_label1, y_image_label2),
|
||||||
|
size_label_image
|
||||||
|
),
|
||||||
|
text="...",
|
||||||
|
manager=self.manager,
|
||||||
|
object_id="empty_field"
|
||||||
|
)
|
||||||
|
pygame_gui.elements.UILabel(
|
||||||
|
relative_rect=pygame.Rect(
|
||||||
|
(x_image1_label2, y_image_label1),
|
||||||
|
size_label_image
|
||||||
|
),
|
||||||
|
text="RECOGNISED SERIES",
|
||||||
|
manager=self.manager,
|
||||||
|
object_id="description"
|
||||||
|
)
|
||||||
|
pygame_gui.elements.UILabel(
|
||||||
|
relative_rect=pygame.Rect(
|
||||||
|
(x_image1_label2, y_image_label2),
|
||||||
|
size_label_image
|
||||||
|
),
|
||||||
|
text="...",
|
||||||
|
manager=self.manager,
|
||||||
|
object_id="empty_field"
|
||||||
|
)
|
||||||
|
|
||||||
|
def image2():
|
||||||
|
pygame_gui.elements.UILabel(
|
||||||
|
relative_rect=pygame.Rect(
|
||||||
|
(x_image2_label1, y_image_label1),
|
||||||
|
size_label_image
|
||||||
|
),
|
||||||
|
text="CORRECT SPEC",
|
||||||
|
manager=self.manager,
|
||||||
|
object_id="description"
|
||||||
|
)
|
||||||
|
# correct spec value
|
||||||
|
pygame_gui.elements.UILabel(
|
||||||
|
relative_rect=pygame.Rect(
|
||||||
|
(x_image2_label1, y_image_label2),
|
||||||
|
size_label_image
|
||||||
|
),
|
||||||
|
text="...",
|
||||||
|
manager=self.manager,
|
||||||
|
object_id="empty_field"
|
||||||
|
)
|
||||||
|
pygame_gui.elements.UILabel(
|
||||||
|
relative_rect=pygame.Rect(
|
||||||
|
(x_image2_label2, y_image_label1),
|
||||||
|
size_label_image
|
||||||
|
),
|
||||||
|
text="RECOGNISED SPEC",
|
||||||
|
manager=self.manager,
|
||||||
|
object_id="description"
|
||||||
|
)
|
||||||
|
pygame_gui.elements.UILabel(
|
||||||
|
relative_rect=pygame.Rect(
|
||||||
|
(x_image2_label2, y_image_label2),
|
||||||
|
size_label_image
|
||||||
|
),
|
||||||
|
text="...",
|
||||||
|
manager=self.manager,
|
||||||
|
object_id="empty_field"
|
||||||
|
)
|
||||||
|
|
||||||
|
params_desc()
|
||||||
|
params_values()
|
||||||
|
cables()
|
||||||
|
image1()
|
||||||
|
image2()
|
||||||
|
|
||||||
|
# frame basics
|
||||||
|
pygame.display.set_caption("disarming...")
|
||||||
|
self.window_surface = pygame.display.set_mode(screen_size)
|
||||||
|
self.background = pygame.Surface(screen_size)
|
||||||
|
self.background.fill(pygame.Color('#000000'))
|
||||||
|
|
||||||
|
# loading the gui
|
||||||
|
gui()
|
||||||
|
|
||||||
|
# ============= #
|
||||||
|
# == showing == #
|
||||||
|
# ============= #
|
||||||
|
|
||||||
|
def show_params(self, mine_type: str, weight: str, danger: str, indicator: str, series: str, spec: str):
|
||||||
|
pygame_gui.elements.UILabel(
|
||||||
|
relative_rect=pygame.Rect(
|
||||||
|
(x_param_values, y_params1),
|
||||||
|
size_label_param_values
|
||||||
|
),
|
||||||
|
text=mine_type,
|
||||||
|
manager=self.manager,
|
||||||
|
object_id="field"
|
||||||
|
)
|
||||||
|
pygame_gui.elements.UILabel(
|
||||||
|
relative_rect=pygame.Rect(
|
||||||
|
(x_param_values, y_params4),
|
||||||
|
size_label_param_values
|
||||||
|
),
|
||||||
|
text=weight,
|
||||||
|
manager=self.manager,
|
||||||
|
object_id="field"
|
||||||
|
)
|
||||||
|
pygame_gui.elements.UILabel(
|
||||||
|
relative_rect=pygame.Rect(
|
||||||
|
(x_param_values, y_params2),
|
||||||
|
size_label_param_values
|
||||||
|
),
|
||||||
|
text=danger,
|
||||||
|
manager=self.manager,
|
||||||
|
object_id="field"
|
||||||
|
)
|
||||||
|
pygame_gui.elements.UILabel(
|
||||||
|
relative_rect=pygame.Rect(
|
||||||
|
(x_param_values, y_params3),
|
||||||
|
size_label_param_values
|
||||||
|
),
|
||||||
|
text=indicator,
|
||||||
|
manager=self.manager,
|
||||||
|
object_id="field"
|
||||||
|
)
|
||||||
|
pygame_gui.elements.UILabel(
|
||||||
|
relative_rect=pygame.Rect(
|
||||||
|
(x_image1_label1, y_image_label2),
|
||||||
|
size_label_image
|
||||||
|
),
|
||||||
|
text=series,
|
||||||
|
manager=self.manager,
|
||||||
|
object_id="field"
|
||||||
|
)
|
||||||
|
pygame_gui.elements.UILabel(
|
||||||
|
relative_rect=pygame.Rect(
|
||||||
|
(x_image2_label1, y_image_label2),
|
||||||
|
size_label_image
|
||||||
|
),
|
||||||
|
text=spec,
|
||||||
|
manager=self.manager,
|
||||||
|
object_id="field"
|
||||||
|
)
|
||||||
|
|
||||||
|
def show_pic_series(self, pic: pygame.Surface):
|
||||||
|
surf = pygame.Surface(size_image)
|
||||||
|
surf.blit(pygame.transform.scale(pic, size_image), (0, 0))
|
||||||
|
pygame_gui.elements.UIImage(
|
||||||
|
image_surface=surf,
|
||||||
|
relative_rect=pygame.Rect(
|
||||||
|
(x_image1, y_image),
|
||||||
|
size_image
|
||||||
|
),
|
||||||
|
manager=self.manager
|
||||||
|
)
|
||||||
|
|
||||||
|
def show_pic_spec(self, pic: pygame.Surface):
|
||||||
|
surf = pygame.Surface(size_image)
|
||||||
|
surf.blit(pygame.transform.scale(pic, size_image), (0, 0))
|
||||||
|
pygame_gui.elements.UIImage(
|
||||||
|
image_surface=surf,
|
||||||
|
relative_rect=pygame.Rect(
|
||||||
|
(x_image2, y_image),
|
||||||
|
size_image
|
||||||
|
),
|
||||||
|
manager=self.manager
|
||||||
|
)
|
||||||
|
|
||||||
|
def show_series(self, series: str, correct: bool):
|
||||||
|
colour = "param_values_correct" if correct else "param_values_wrong"
|
||||||
|
pygame_gui.elements.UILabel(
|
||||||
|
relative_rect=pygame.Rect(
|
||||||
|
(x_param_values, y_params5),
|
||||||
|
size_label_param_values
|
||||||
|
),
|
||||||
|
text=series,
|
||||||
|
manager=self.manager,
|
||||||
|
object_id="field"
|
||||||
|
)
|
||||||
|
pygame_gui.elements.UILabel(
|
||||||
|
relative_rect=pygame.Rect(
|
||||||
|
(x_param_values, y_params5),
|
||||||
|
size_light
|
||||||
|
),
|
||||||
|
text="",
|
||||||
|
manager=self.manager,
|
||||||
|
object_id=colour
|
||||||
|
)
|
||||||
|
pygame_gui.elements.UILabel(
|
||||||
|
relative_rect=pygame.Rect(
|
||||||
|
(x_image1_label2, y_image_label2),
|
||||||
|
size_label_image
|
||||||
|
),
|
||||||
|
text=series,
|
||||||
|
manager=self.manager,
|
||||||
|
object_id=colour
|
||||||
|
)
|
||||||
|
|
||||||
|
def show_spec(self, spec: str, correct: bool):
|
||||||
|
colour = "param_values_correct" if correct else "param_values_wrong"
|
||||||
|
pygame_gui.elements.UILabel(
|
||||||
|
relative_rect=pygame.Rect(
|
||||||
|
(x_param_values, y_params6),
|
||||||
|
size_label_param_values
|
||||||
|
),
|
||||||
|
text=spec,
|
||||||
|
manager=self.manager,
|
||||||
|
object_id="field"
|
||||||
|
)
|
||||||
|
pygame_gui.elements.UILabel(
|
||||||
|
relative_rect=pygame.Rect(
|
||||||
|
(x_param_values, y_params6),
|
||||||
|
size_light
|
||||||
|
),
|
||||||
|
text="",
|
||||||
|
manager=self.manager,
|
||||||
|
object_id=colour
|
||||||
|
)
|
||||||
|
pygame_gui.elements.UILabel(
|
||||||
|
relative_rect=pygame.Rect(
|
||||||
|
(x_image2_label2, y_image_label2),
|
||||||
|
size_label_image
|
||||||
|
),
|
||||||
|
text=spec,
|
||||||
|
manager=self.manager,
|
||||||
|
object_id=colour
|
||||||
|
)
|
||||||
|
|
||||||
|
def show_cable_calculated(self, colour: str):
|
||||||
|
pygame_gui.elements.UILabel(
|
||||||
|
relative_rect=pygame.Rect(
|
||||||
|
(x_cables, y_cable1),
|
||||||
|
size_cable
|
||||||
|
),
|
||||||
|
text=colour,
|
||||||
|
manager=self.manager,
|
||||||
|
object_id=colour
|
||||||
|
)
|
||||||
|
|
||||||
|
def show_cable_chosen(self, colour: str):
|
||||||
|
pygame_gui.elements.UILabel(
|
||||||
|
relative_rect=pygame.Rect(
|
||||||
|
(x_cables, y_cable2),
|
||||||
|
size_cable
|
||||||
|
),
|
||||||
|
text=colour,
|
||||||
|
manager=self.manager,
|
||||||
|
object_id=colour
|
||||||
|
)
|
||||||
|
|
||||||
|
# ========= #
|
||||||
|
# == run == #
|
||||||
|
# ========= #
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
|
||||||
|
while self.running:
|
||||||
|
|
||||||
|
time_delta = self.clock.tick(60) / 1000.0
|
||||||
|
|
||||||
|
keystate = pygame.key.get_pressed()
|
||||||
|
|
||||||
|
# all events except QUIT are for testing
|
||||||
|
for event in pygame.event.get():
|
||||||
|
if event.type == pygame.QUIT:
|
||||||
|
self.running = False
|
||||||
|
if keystate[pygame.K_a]:
|
||||||
|
self.show_params("hello", "yello", "gel", "jello", "yum", "hello")
|
||||||
|
if keystate[pygame.K_s]:
|
||||||
|
self.show_series("workhorse 3200wx", True)
|
||||||
|
if keystate[pygame.K_d]:
|
||||||
|
self.show_spec("anti aircraft", False)
|
||||||
|
if keystate[pygame.K_f]:
|
||||||
|
self.show_cable_calculated("red")
|
||||||
|
if keystate[pygame.K_g]:
|
||||||
|
self.show_cable_chosen("blue")
|
||||||
|
if keystate[pygame.K_q]:
|
||||||
|
self.show_pic_series(ASSET_CONCRETE)
|
||||||
|
if keystate[pygame.K_w]:
|
||||||
|
self.show_pic_spec(ASSET_CONCRETE)
|
||||||
|
|
||||||
|
self.manager.update(time_delta)
|
||||||
|
self.window_surface.blit(self.background, (0, 0))
|
||||||
|
self.manager.draw_ui(self.window_surface)
|
||||||
|
|
||||||
|
pygame.display.update()
|
||||||
|
|
||||||
|
|
||||||
|
def disarming_popup():
|
||||||
|
# run the pop-up
|
||||||
|
app = SampleWindow()
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
# bring display back to normal
|
||||||
|
pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
|
||||||
|
pygame.display.set_caption(V_NAME_OF_WINDOW)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
pygame.init()
|
||||||
|
disarming_popup()
|
77
disarm_popup/theme.json
Normal file
77
disarm_popup/theme.json
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
{
|
||||||
|
|
||||||
|
"#font_colour":
|
||||||
|
{
|
||||||
|
"colours":
|
||||||
|
{
|
||||||
|
"normal_text": "#c5cbd8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"description":
|
||||||
|
{
|
||||||
|
"prototype": "#font_colour",
|
||||||
|
"colours":
|
||||||
|
{
|
||||||
|
"dark_bg": "#222222"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"empty_field":
|
||||||
|
{
|
||||||
|
"prototype": "#font_colour",
|
||||||
|
"colours":
|
||||||
|
{
|
||||||
|
"dark_bg": "#333333"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"field":
|
||||||
|
{
|
||||||
|
"prototype": "#font_colour",
|
||||||
|
"colours":
|
||||||
|
{
|
||||||
|
"dark_bg": "#444444"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"param_values_correct":
|
||||||
|
{
|
||||||
|
"prototype": "#font_colour",
|
||||||
|
"colours":
|
||||||
|
{
|
||||||
|
"dark_bg": "#738469"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"param_values_wrong":
|
||||||
|
{
|
||||||
|
"prototype": "#font_colour",
|
||||||
|
"colours":
|
||||||
|
{
|
||||||
|
"dark_bg": "#846f69"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"blue":
|
||||||
|
{
|
||||||
|
"colours":
|
||||||
|
{
|
||||||
|
"dark_bg": "#465080"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"green":
|
||||||
|
{
|
||||||
|
"colours":
|
||||||
|
{
|
||||||
|
"dark_bg": "#498046"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"red":
|
||||||
|
{
|
||||||
|
"colours":
|
||||||
|
{
|
||||||
|
"dark_bg": "#804e46"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -39,12 +39,9 @@ V_SIDE_MENU_WIDTH = 80
|
|||||||
V_INPUT_BOX_HEIGHT = 55
|
V_INPUT_BOX_HEIGHT = 55
|
||||||
V_BUTTON_HEIGHT = 40
|
V_BUTTON_HEIGHT = 40
|
||||||
|
|
||||||
SCREEN = pygame.display.set_mode(
|
SCREEN_WIDTH = V_TILE_AREA_WIDTH + 2 * V_SCREEN_PADDING + V_NUMBER_PADDING + V_SIDE_MENU_WIDTH + 10
|
||||||
(
|
SCREEN_HEIGHT = V_TILE_AREA_HEIGHT + 2 * V_SCREEN_PADDING + V_NUMBER_PADDING
|
||||||
V_TILE_AREA_WIDTH + 2 * V_SCREEN_PADDING + V_NUMBER_PADDING + V_SIDE_MENU_WIDTH + 10, # screen width
|
SCREEN = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
|
||||||
V_TILE_AREA_HEIGHT + 2 * V_SCREEN_PADDING + V_NUMBER_PADDING # screen height
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
# =============== #
|
# =============== #
|
||||||
|
Loading…
Reference in New Issue
Block a user