Add button create new element in centralbox.
Reset destroy all elements in centralbox, green area and red area.

main.py
Code: Select all
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
import pygame
import thorpy
from mss import mss
import funky
from funky import *
screen = mss().monitors[1]
print(screen)
WIDTH = screen['width']
HEIGHT = screen['height']
douz_W = int(WIDTH/12)
douz_H = int(HEIGHT/12)
application = thorpy.Application((WIDTH, HEIGHT), " TEST")
title_element = thorpy.make_text("Bla bla bla", 25, (0,255,50))
ADD = thorpy.make_button("ADD", func = create_mission)
MODIFY = thorpy.make_button("MODIFY", func = create_mission)
FREEZE = thorpy.make_button("FREEZE", func = create_mission)
EXPORT = thorpy.make_button("EXPORT", func = create_mission)
IMPORT = thorpy.make_button("IMPORT", func = create_mission)
CANCEL = thorpy.make_button("CANCEL", func = create_mission)
RESET = thorpy.make_button("RESET", func = create_mission)
barbuttonlist = [ADD,MODIFY,FREEZE,EXPORT,IMPORT,CANCEL,RESET]
barbuttonlist[0].set_main_color((0,0,255))
barbuttonlist[1].set_main_color((255,145,0))
barbuttonlist[2].set_main_color((125,125,125))
barbuttonlist[3].set_main_color((10,170,200))
barbuttonlist[4].set_main_color((160,70,180))
barbuttonlist[5].set_main_color((200,0,0))
barbuttonlist[6].set_main_color((255,0,0))
clicksgroup = thorpy.make_group(barbuttonlist, "h")
indicator = thorpy.Element.make(" MISSION A ")
thorpy.makeup.add_basic_help(indicator,"Destroy all ennemy tanks.")
validator = thorpy.make_button("v")
thorpy.makeup.add_basic_help(validator,"click here to accept")
validator.set_main_color((0,255,0,70))
xannihilator = thorpy.make_button("X")
thorpy.makeup.add_basic_help(xannihilator,"click here to reject")
xannihilator.set_main_color((255,0,0,50))
indicator2 = thorpy.Element.make(" MISSION B ")
thorpy.makeup.add_basic_help(indicator2,"Build nuclear power plant")
validator2 = thorpy.make_button("v")
thorpy.makeup.add_basic_help(validator2,"click here to accept")
validator2.set_main_color((0,255,0,70))
xannihilator2 = thorpy.make_button("X")
thorpy.makeup.add_basic_help(xannihilator2,"click here to reject")
xannihilator2.set_main_color((255,0,0,50))
activline_1 = [indicator,validator,xannihilator]
activline_2 = [indicator2,validator2,xannihilator2]
activgroup_1 = thorpy.make_group(activline_1, "h")
activgroup_2 = thorpy.make_group(activline_2, "h")
elements = [clicksgroup,activgroup_1,activgroup_2]
central_box = thorpy.Box.make(elements=elements,
size=(9*douz_W,5*douz_H))
failed_box = thorpy.Box.make(elements=None,
size=(9*douz_W,2*douz_H))
succes_box = thorpy.Box.make(elements=None,
size=(9*douz_W,2*douz_H))
central_box.center()
central_box.add_lift()
central_box.set_main_color((220,220,220,70))
failed_box.add_lift()
failed_box.set_main_color((255,0,0,90))
succes_box.add_lift()
succes_box.set_main_color((0,255,0,70))
background = thorpy.Background.make(image=thorpy.style.EXAMPLE_IMG,
elements=[title_element, central_box,failed_box,succes_box])
thorpy.store(background)
menu = thorpy.Menu(background)
menu.play()
application.quit()
funky.py
Code: Select all
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
import pygame
import thorpy
#import arrow
class Mission():
def __init__(self, title = None,corpus = None):
self.title = title
self.corpus = corpus
def print_self(self):
print(self.__dict__)
def create_mission():
tit = input("\n Title : ")
cor = input("\n corpus : ")
#x = Mission(tit,cor,them,creationdate = arrow.utcnow())
x = Mission(tit,cor,them)
print("\n create_mission")
x.print_self()