Exemple #1
0
def set_up(width, height):
    font = glFreeType.font_data( "free_sans.ttf", 30 )
    glOrtho(0.0, width, 0.0, height,-1.0,1.0)
    glClearColor(0.0,0.0,0.0,0.0)

    widgets_list["object_text"] = widgets.Text_Box(0,500, True, "reimu")
    widgets_list["object_button"] = widgets.Button(25, 560, "button", "button_down", load_spritesheet, (widgets_list["object_text"],))
    widgets_list["spritesheet"] = widgets.Null_Widget()

    widgets_list["action_name"] = widgets.Text_Box(200,500, True, "idle-s")
    widgets_list["frame_number"] = widgets.Int_Box(200,480, True, "0")
    widgets_list["frame_x"] = widgets.Int_Box(200,460, True, "0")
    widgets_list["frame_y"] = widgets.Int_Box(260,460, True, "0")
    widgets_list["frame_w"] = widgets.Int_Box(200,440, True, "0")
    widgets_list["frame_h"] = widgets.Int_Box(260,440, True, "0")
    widgets_list["selection"] = widgets.Selection_Box(10,10,100,100,widgets_list, "spritesheet")
    f = widgets_list["selection"].set_dimensions
    args = widgets_list["frame_x"], widgets_list["frame_y"], widgets_list["frame_w"], widgets_list["frame_h"]
    widgets_list["frame_button"] = widgets.Button(210, 520, "button", "button_down", f, args)
    widgets_list["save_button"] = widgets.Button(180, 400, "button", "button_down", save_frame,())
    pygame.time.set_timer(pygame.USEREVENT+1, 300)
    global animated
    try:

        animated = widgets.Animated(600,470,"reimu")
        #print animated.data.actions
        for a in animated.data.actions:
            print a, ": ",
            for f in animated.data.actions[a]:
                print f,
            print ""

    except:
        print "Load Failed"
def main_menu():
    """ Runs the main menu of the game. """

    # Create buttons.
    widgets_list = [
        widgets.Button(int(SCREEN_WIDTH / 2), 15, "Start Game",
                       eval(SETTING_DATA[b"Button Color"][b"COLOR"]),
                       "run_game()"),
        widgets.Button(int(SCREEN_WIDTH / 2), 18, "Exit",
                       eval(SETTING_DATA[b"Button Color"][b"COLOR"]), "exit()")
    ]

    # Create loop for the menu to run.
    while not roguelib.console_is_window_closed():

        title = SETTING_DATA[b"Title Text"][b"TEXT"]

        # Display title+widgets.
        roguelib.console_set_default_foreground(
            0, eval(SETTING_DATA[b"Title Color"][b"COLOR"]))
        roguelib.console_print_ex(0, int(SCREEN_WIDTH / 2), 5,
                                  roguelib.BKGND_NONE, roguelib.CENTER, title)

        for widget in widgets_list:

            roguelib.console_set_default_foreground(0, widget.color[0])
            roguelib.console_print_ex(0, widget.x, widget.y,
                                      roguelib.BKGND_NONE, roguelib.CENTER,
                                      widget.text)

        roguelib.console_flush()

        # Get key control events.
        mouse, key = check_for_key_events()

        # Check for widget actions.
        for widget in widgets_list:

            widget.selected(mouse)
            if widget.detect_click(mouse):

                eval(widget.action)

        # If enter is pressed, start game.
        if key.vk == roguelib.KEY_ENTER:

            run_game()
            break

        # If escape is pressed, exit game.
        if key.vk == roguelib.KEY_ESCAPE:

            break
Exemple #3
0
    def foreground(self):
        """Activate the application."""

        self.del_alarm_btn = widgets.Button(170, 204, 70, 35, 'DEL')
        self.hours_wid = widgets.Spinner(50, 30, 0, 23, 2)
        self.min_wid = widgets.Spinner(130, 30, 0, 59, 2)
        self.day_btns = (widgets.ToggleButton(10, 145, 40, 35, 'Mo'),
                         widgets.ToggleButton(55, 145, 40, 35, 'Tu'),
                         widgets.ToggleButton(100, 145, 40, 35, 'We'),
                         widgets.ToggleButton(145, 145, 40, 35, 'Th'),
                         widgets.ToggleButton(190, 145, 40, 35, 'Fr'),
                         widgets.ToggleButton(10, 185, 40, 35, 'Sa'),
                         widgets.ToggleButton(55, 185, 40, 35, 'Su'))
        self.alarm_checks = (widgets.Checkbox(200,
                                              57), widgets.Checkbox(200, 102),
                             widgets.Checkbox(200,
                                              147), widgets.Checkbox(200, 192))

        self._deactivate_pending_alarms()
        self._draw()

        wasp.system.request_event(wasp.EventMask.TOUCH
                                  | wasp.EventMask.SWIPE_LEFTRIGHT
                                  | wasp.EventMask.BUTTON)
        wasp.system.request_tick(1000)
Exemple #4
0
	def build_menu(self):
		g.scene.menu = [
			widgets.Button(i[0],i[1],(5,g.button_slots[i[2]]),i[3],back=i[4]) for i in(
				[ 'Attack', "It's time to suffer", 0, self.attack, '01' ],
				[ 'Wait', "Hum... Let me think", 1, self.wait, '02']
			)
		]
Exemple #5
0
 def touch(self, event):
     if self._btn.touch(event):
         if ble.enabled():
             ble.disable()
             self._btn = widgets.Button(10, 120, 220, 80, 'Reboot to enable')
             self._draw()
         else:
             wasp.machine.reset()
Exemple #6
0
def create_button(i, j, label=""):
    return widgets.Button(
        lcd,
        x1=int(i * (lcd.w / COLS) + PAD),
        y1=int(j * (lcd.h / ROWS) + PAD),
        x2=int((i + 1) * (lcd.w / COLS) - PAD),
        y2=int((j + 1) * (lcd.h / ROWS) - PAD),
        label=label,
    )
Exemple #7
0
    def load(self):
        # Initialize items
        self.loginButton = widgets.Entity((screensize[0]/2)-(200+50), 400, 200, 100, (255, 255, 255))
        self.registerButton = widgets.Button((screensize[0]/2)-(-50), 400, 200, 100, (255, 255, 255), text="Signup")
        self.usernameBox = widgets.TextBox((screensize[0]/2)-(500/2), 200, 500, 40, question="Username: "******"Password: "******"Login", True, pygame.color.Color(0, 0, 0))
        self.loginButton.blit(self.loginButtonText, (25, 25))
Exemple #8
0
	def __init__(self):
		print "Battle started"
		self.sequence = [g.PC, g.foe] #TODO call function that calculates the first strike
		self.battle_round = 1
		self.turn = 0
		self.acting = self.sequence[self.turn]
		"""Creates a menu for the player to choose his bobot"""
		g.scene.menu = [widgets.Button(bobot.gender, bobot.color+" "+bobot.stage, (5, g.button_slots[g.PC.robots.index(bobot)]), bobot.choose_me) for bobot in g.PC.robots ]
		g.pending_actions.append(interface.fight)
		g.pending_actions.append(self.start_battle)
 def add_pattern(self, pattern):
     self.patterns.append(pattern)
     components_manager = ComponentsManager(pattern)
     self.set_current_components_manager(components_manager)
     self.components_managers.append(components_manager)
     self.widget.add_item(
         widgets.Button(pattern.name,
                        callback=partial(
                            self.set_current_components_manager,
                            components_manager)))
Exemple #10
0
 def __init__(self, screen, parent=False, username=False):
     self.screen = screen
     self.parent = parent
     self.username = username
     self.load()
     if self.parent:
         self.backButton = widgets.Button(25, screensize[1]-75, 100, 50, (255, 255, 255), text="Back")
     if self.username:
         self.loggedinText = widgets.Text(800, 650, "Logged in as "+self.username, 30)
     self.update()
Exemple #11
0
 def next(self):
     if self.speech < len(self.speeches):
         g.board.new_message(self.speeches[self.speech], side="right")
         self.menu = [
             widgets.Button(i[0],
                            i[1], (5, g.button_slots[i[2]]),
                            i[3],
                            back=i[4])
             for i in (['Next', 'Proceed, please.', 0, self.next, '01'], )
         ]
         self.speech += 1
     else:
         self.dialog_key = 1
Exemple #12
0
 def menu_load_game(self):
     savefiles = [i for i in os.listdir('saves')
                  if i[-7:] == '.bobots'][0:4]
     g.menu = []
     counter = 0
     for i in savefiles:
         filepath = os.path.join(os.getcwd(), 'saves', i)
         S = save.Saved_Game(filepath)
         g.menu.append(
             widgets.Button("%s, level %s" %
                            (S.robot1['type'], S.robot1['level']),
                            "Money: $%s Rank: %s" % (S.money, S.rank),
                            (5, g.button_slots[counter]),
                            self.load_game,
                            counter,
                            arguments={'filepath': filepath}))
         counter += 1
Exemple #13
0
 def menu_settings(self):
     g.menu = [
         widgets.Button(i[0],
                        i[1], (5, g.button_slots[i[2]]),
                        i[3],
                        back=i[4])
         for i in ([
             'Resolution', 'Strach or squash to fit', 0, self.menu_main,
             '01'
         ], [
             'Volume', "Could you speak louder, please?", 1, self.menu_main,
             '02'
         ], [
             'Controls', "Let's shuffle some keys", 2, self.menu_main, '03'
         ], [
             'Language', "Ask Babel Fish some help", 3, self.menu_main, '04'
         ])
     ]
Exemple #14
0
 def __init__(self):
     self.menu = [
         widgets.Button(i[0], i[1], (5, i[2]), i[3], back=i[4]) for i in ([
             'Challenge',
             "You are no match for any prototype I've designed", 60,
             self.button_challenge, '01'
         ], [
             'Run Away', "So sorry, sir, I didn't mean to disturb", 160,
             self.button_runaway, '02'
         ], [
             'To the street', "I need some fresh air", 260,
             self.button_street, '03'
         ], [
             'To the school', "Maybe I should try to learn something", 360,
             self.button_school, '04'
         ])
     ]
     scenes.Scene.__init__(self, )
Exemple #15
0
    def on_center(self):
        if self.speech == 0:
            self.next()

        if self.dialog_key:
            if self.wait and self.wait < 1000:
                self.wait -= 1
            if not self.wait:
                g.foe.talk(self.dialogs[self.dialog_key][0])
                self.menu = [
                    widgets.Button(i[0],
                                   i[1], (5, g.button_slots[i[2]]),
                                   i[3],
                                   back=i[4])
                    for i in self.dialogs[self.dialog_key][1]
                ]
                print self.menu
                self.wait = 1001
Exemple #16
0
    def __init__(self, message, widg, *args, **kwargs):
        wdg.Toplevel.__init__(self, *args, **kwargs)

        self.widg = widg
        self.title('Date Error')
        self.grid_columnconfigure(0, weight=1)
        self.grid_rowconfigure(0, weight=1)

        frm = wdg.FrameHilited(self)
        lab = wdg.LabelHilited(frm, text=message)
        close = wdg.Button(self, text='OK', command=self.close)

        frm.grid(column=0, row=0, padx=24, pady=(24, 0), sticky='news')
        lab.grid(column=0, row=0, padx=24, pady=24)
        close.grid(column=0, row=1, pady=12)
        close.focus_set()
        self.grab_set()

        ST.config_generic(self)
Exemple #17
0
 def menu_main(self):
     return [
         widgets.Button(i[0],
                        i[1], (5, g.button_slots[i[2]]),
                        i[3],
                        back=i[4])
         for i in ([
             'Start new game', "The adventure is about to begin", 0,
             self.new_game, '01'
         ], [
             'Load saved game', "Whatch out everyone, I'm back!", 1,
             self.menu_load_game, '02'
         ], [
             'Change preferences', "I'll have it my own way.", 2,
             self.menu_settings, '03'
         ], [
             'See credicts', "Who's fault is this?", 3, self.start_game,
             '04'
         ])
     ]
Exemple #18
0
 def on_center(self):
     if not self.count:
         g.foe.talk("So you have a bobot! Let's fight!")
         self.menu = [
             widgets.Button(i[0],
                            i[1], (5, g.button_slots[i[2]]),
                            i[3],
                            back=i[4])
             for i in ([
                 'Challenge',
                 "You are no match for any prototype I've designed", 0,
                 self.button_challenge, '01'
             ], [
                 'Run Away', "So sorry, sir, I didn't mean to disturb", 1,
                 self.button_runaway, '02'
             ], [
                 'To the park', "I need some fresh air", 2,
                 self.button_park, '03'
             ], [
                 'To the school', "Maybe I should try to learn something",
                 3, self.button_school, '04'
             ])
         ]
     self.count += 1
Exemple #19
0
    def build_client_widgets(self, client):
        d = {
            'tgltest1': {
                'cls': widgets.Toggle
            },
            'btntest1': {
                'cls': widgets.Button
            },
            'fdrtest1': {
                'cls': widgets.Fader,
                'group': 'Dimmer',
                'attr': 'value'
            },
            'xytest1': {
                'cls': widgets.xyPad,
                'group': 'Position',
                'attr': 'value_seq'
            },
            'label1': {
                'cls': widgets.Label
            }
        }
        self.testwidgets.update({client: {}})
        for name, info in d.iteritems():
            w_kwargs = dict(osc_address=name,
                            osc_parent_node=self.osc_node,
                            label=name,
                            client=client)
            if 'group' in info:
                g = self.MainController.Selection.AttributeGroups[
                    info['group']]
                w_kwargs.update({
                    'src_object': g,
                    'src_attr': info['attr'],
                    'src_signal': 'value_changed'
                })
            w = info['cls'](**w_kwargs)
            w.connect('value_update', self.on_testwidget_update)
            self.testwidgets[client].update({name: w})
            w.set_link_state(True)
        for x in range(1, 9):
            csnode = self.osc_node.add_new_node(name='CueStack')
            btnnode = csnode.add_new_node(name='push')
            lblnode = csnode.add_new_node(name='label')

            w_kwargs = dict(osc_address=str(x), client=client)
            stack = self.MainController.CueStacks.values()[0]
            snapshot = stack.snapshots_indexed.get(x)
            if snapshot:
                w_kwargs.update({
                    'src_object': snapshot,
                    'src_attr': 'active',
                    'src_signal': 'active_changed',
                    'osc_parent_node': btnnode
                })
                w = widgets.Button(**w_kwargs)
                self.testwidgets[client].update(
                    {'/'.join(['push', w.osc_address]): w})
                w.set_link_state(True)
                w_kwargs.update({
                    'src_attr': 'name',
                    'src_signal': 'property_changed',
                    'osc_parent_node': lblnode,
                    'label': snapshot.name
                })
                w = widgets.Label(**w_kwargs)
                self.testwidgets[client].update(
                    {'/'.join(['push', w.osc_address]): w})
                w.set_link_state(True)
Exemple #20
0
# label4 = wdg.Label(root,text='Text:')
# label4.grid(column=0, row=5)

# text = wdg.Text(root, width=40, height=1)
# text.grid(column=1, row=5, columnspan=2)
# text.insert(1.0, '1601')

show = wdg.Label(root)
show.grid(column=0, row=6, columnspan=2)

widgets = [simple, mostring, clarif3, clarif2, ranje, span, span1, span2]

u = 0
for widg in widgets:
    button = wdg.Button(root,
                        text='Validate',
                        command=lambda widg=widg: dates.get_widg_type(widg))
    button.grid(column=u, row=2)
    u += 1


def focus_next_window(event):
    event.widget.tk_focusNext().focus()
    return ("break")


# DO NOT DELETE
# text.bind("<Tab>", focus_next_window)
# for widg in (combobox, text):
# widg.bind('<FocusOut>', get_event)
Exemple #21
0
 def __init__(self):
     self._btn = widgets.Button(10, 120, 220, 80, 'Disable' if ble.enabled() else 'Reboot to enable')
Exemple #22
0
    def drawWidgets(self):
        # First create column headers
        pad = (1, 1)
        for j in range(self.noColumns):
            # widgetFrame = TK.Frame(self.tableFrame,width=self.columns[j]['width'],
            #                        height=DEFAULTCELLHEIGHT)
            # widgetFrame.pack_propagate(0) # Stops child widgets of label_frame from resizing it
            cell = widgets.Label(self.tableFrame)
            cell.configure(bg=self.columns[j]['bg'],
                           fg=self.columns[j]['fg'],
                           relief=TK.RAISED)
            #cell.config(width=self.columns[j]['width'])

            cell.grid(row=0, column=j, sticky='ew')
            #cell.pack(expand=TK.YES, fill=TK.BOTH)
            cell.setText(self.columns[j]['text'])
            cell.tableRow = -1
            cell.tableColumn = j
            cell.bind("<Button-1>", self._click)
            pad = (1, 1)
            if j == 0: pad = (2, 1)
            if j == self.noColumns - 1: pad = (1, 2)
            #widgetFrame.grid(row=0, column=j, padx=pad, pady=(2,1))

        # Second create cell widgets
        for i in range(self.visibleRows):
            widgetRow = []
            for j in range(self.noColumns):
                widgetName = self.columns[j].get('widget',
                                                 'Label')  # Default to label
                # widgetFrame = TK.Frame(self.tableFrame,width=self.columns[j]['width'],
                #                        height=DEFAULTCELLHEIGHT) #,
                # widgetFrame.pack_propagate(0) # Stops child widgets of label_frame from resizing it
                if widgetName == 'Textbox':
                    cellWidget = widgets.Textbox(self.tableFrame)
                    #cellWidget.config(width=columns[j]['width')
                    cellWidget.bind('<Return>', self._dataChanged)
                    cellWidget.bind('<Escape>', self._cancelChange)
                    cellWidget.bind("<FocusOut>", self._dataChanged)
                    #cellWidget.bind("<Leave>", self._click) # Must decide if this is sensible behaviour
                elif widgetName == 'Button':
                    cellWidget = widgets.Button(
                        self.tableFrame)  #, command=self._dataChanged)
                    cellWidget.bind('<ButtonRelease>', self._dataChanged)
                    # cellWidget.config(command=self.dataChanged)
                elif widgetName == 'Checkbox':
                    cellWidget = widgets.Checkbox(self.tableFrame)
                elif widgetName == 'Combobox':
                    cellWidget = widgets.Combobox(self.tableFrame)
                    cellWidget.bind("<<ComboboxSelected>>", self._dataChanged)
                else:
                    cellWidget = widgets.Label(self.tableFrame)
                    cellWidget.config(relief=TK.RAISED)
                cellWidget.config(width=self.columns[j]['width'])
                cellWidget.widgetType = widgetName
                #cellWidget.pack(expand=TK.YES, fill=TK.BOTH)
                align = self.columns[j].get('align', '')
                if align:
                    cellWidget.configure(anchor=ANCHOR[align])
                cellWidget.grid(row=i + 1, column=j, stick='ew')
                cellWidget.setText('')
                cellWidget.tableRow = i
                cellWidget.tableColumn = j
                cellWidget.dataCoords = [
                ]  # The row/column in the data matrix - set when table populated
                cellWidget.bind("<Button-1>", self._click)
                widgetRow.append(cellWidget)
                pad = (1, 1)
                ypad = (1, 1)
                if j == 0: pad = (2, 1)
                if j == self.noColumns - 1: pad = (1, 2)
                if i == self.visibleRows - 1: ypad = (1, 2)
                #widgetFrame.grid(row=i+1, column=j, padx=pad, pady=ypad)
            self.widgets.append(widgetRow)
        if self.data:
            if len(self.data) > self.visibleRows:
                self.scroll = True
                col = len(self.columns)
                x = len(self.data) - self.visibleRows
                self.addVerticalScroll(x)
                #self.vertical_scroll = TK.Scale(self.tableFrame, orient=TK.VERTICAL, from_=0, to=x, command=self.v_scroll, showvalue=0)
                #self.vertical_scroll.grid(row=1,column=col, rowspan=self.visibleRows, sticky=TK.N+TK.S)
        elif self.scroll:
            col = len(self.columns)
            x = 0
            self.addVerticalScroll(x)
            #self.vertical_scroll = TK.Scale(self.tableFrame, orient=TK.VERTICAL, from_=0, to=x, command=self.v_scroll, showvalue=0)
            #self.vertical_scroll.grid(row=1,column=col, rowspan=self.visibleRows, sticky=TK.N+TK.S)

        # Get parent frame width and height - x and y coordinates can also be accessed
        self.tableFrame.update(
        )  # Required to get frame width and height at this time
        self.width = self.tableFrame.winfo_width()
        self.height = self.tableFrame.winfo_height()
from touch_event_manager import TouchEventManager
import widgets

from _DEVICE_ID import _DEVICE_ID
device = MNTDevice(_DEVICE_ID)

tem = TouchEventManager(device)

################ Define Widgets ################

# Buttons

reload_button = widgets.Button(
    tem, 
    name='reload', 
    center=(1080 - 1005, 1701)
    )

jump_button = widgets.Button(
    tem,
    name='jump',
    center=(1080 - 754, 2075)
)

crouch_button = widgets.Button(
    tem,
    name='crouch',
    center=(1080 - 1012, 1852)
)
    label4 = wdg.Label(root, text='Text:', takefocus=1)
    label4.grid(column=0, row=5)

    text = wdg.Text(root, width=40, height=1)
    text.grid(column=1, row=5, columnspan=2)
    text.insert(1.0, '1601')

    show = wdg.Label(root)
    show.grid(column=0, row=6, columnspan=2)

    widgets = [simple, mostring, clarif3, clarif2, ranje, span, span1, span2]

    u = 0
    for widg in widgets:
        button = wdg.Button(
            root,
            text='Validate',
            command=lambda widg=widg: validate.run_validator(widg))
        button.grid(column=u, row=2)
        u += 1

    def focus_next_window(event):
        event.widget.tk_focusNext().focus()
        return ("break")

    text.bind("<Tab>", focus_next_window)
    for widg in (combobox, text):
        widg.bind('<FocusOut>', get_event)

    ST.config_generic(root)

    root.mainloop()
import pygame
from pyminitouch import MNTDevice
import time

from touch_event_manager import TouchEventManager
import widgets

from _DEVICE_ID import _DEVICE_ID
device = MNTDevice(_DEVICE_ID)

# Register the buttons

tem = TouchEventManager(device)

operation_start_button_1 = widgets.Button(tem,
                                          name='operation_start_1',
                                          center=(985, 2160 - 1938))

operation_start_button_2 = widgets.Button(tem,
                                          name='operation_start_2',
                                          center=(763, 2160 - 1772))

give_up_operation_button = widgets.Button(tem,
                                          name='give_up_operation',
                                          center=(763, 2160 - 775))

# Profiles
p_OF_F4 = {'time': 138}
p_OF_8 = {'time': 180}

# Running settings
    def __init__(self, screen):
        MenuScreen.__init__(self, screen, 'Hotseat Setup')
        self.listsize = (gwglob.MID_FONT.size('W' * gwglob.PLAYER_MAXNAME)[0] +
                         20, gwglob.MID_FONT_SIZE[1] * gwglob.PLAYER_MAX + 20)
        self.menu = widgets.Menu(self, (100, self.page))
        self.add = widgets.Button(self,
                                  (90, self.page + self.listsize[1] + 10),
                                  'Add', self.addplayer,
                                  widgets.STYLE_MID_FONT)
        self.remove = widgets.Button(
            self,
            (90 + self.add.width + 10, self.page + self.listsize[1] + 10),
            'Remove', self.removeplayer, widgets.STYLE_MID_FONT, True)
        name = widgets.Label(self, (110 + self.listsize[0], self.page - 10),
                             'Name:', widgets.STYLE_MID_FONT)
        color = widgets.Label(
            self, (110 + self.listsize[0], self.page + name.height + 5),
            'Color:   ', widgets.STYLE_MID_FONT)
        self.name = widgets.Entry(
            self, (123 + self.listsize[0] + color.width, self.page - 10),
            'Player 1', gwglob.PLAYER_MAXNAME, widgets.STYLE_MID_FONT)
        self.color = widgets.ColorDisplay(
            self, (110 + self.listsize[0] + color.width,
                   self.page + name.height + 5),
            (color.height - 6, color.height - 6), (255, 0, 0))
        self.red = widgets.ColorBar(
            self, (110 + self.listsize[0] + color.width,
                   self.page + name.height + color.height + 10), (255, 10), 0,
            255)
        self.green = widgets.ColorBar(
            self, (110 + self.listsize[0] + color.width,
                   self.page + name.height + color.height + 30), (255, 10), 1)
        self.blue = widgets.ColorBar(
            self, (110 + self.listsize[0] + color.width,
                   self.page + name.height + color.height + 50), (255, 10), 2)
        start = widgets.Button(self, (0, 0), 'Start', self.start,
                               widgets.STYLE_BIG_FONT)
        start.topright = (gwglob.SIZE[0] / 2 - 5,
                          gwglob.SIZE[1] - start.height - 100)
        exit = widgets.Button(self, (0, 0), 'Exit', self.exit,
                              widgets.STYLE_BIG_FONT)
        exit.topleft = (gwglob.SIZE[0] / 2 + 5,
                        gwglob.SIZE[1] - start.height - 100)
        self.profiles = widgets.ButtonDropDown(
            self, (110 + self.listsize[0] + color.width,
                   self.name.topleft[1] + self.name.height / 2 - 6))

        def drawicon(b=None, pos=None):
            if b == None:
                return (5, 5)
            c = widgets.STYLE_MID_FONT.color(b)
            pygame.draw.line(b.screen, c, (pos[0] + 2, pos[1]),
                             (pos[0] + 2, pos[1] + 4))
            pygame.draw.line(b.screen, c, (pos[0], pos[1] + 2),
                             (pos[0] + 4, pos[1] + 2))

        add = widgets.IconButton(
            self, (125 + self.listsize[0] + color.width + self.name.width,
                   self.name.topleft[1] + self.name.height / 2 - 6), drawicon,
            self.addprofile)
        self.pack(self.menu)
        self.pack(self.add)
        self.pack(self.remove)
        self.pack(name)
        self.pack(color)
        self.pack(self.name)
        self.pack(self.color)
        self.pack(self.red)
        self.pack(self.green)
        self.pack(self.blue)
        self.pack(start)
        self.pack(exit)
        self.pack(add)
        self.pack(self.profiles)
        self.addplayer()
        self.addplayer(select=False)
        for text, color in gwglob.SETTINGS.get('profiles', []):
            self.addprofile(None, text, color)
Exemple #27
0
sizeSpecs = [widgets.Size('expandToFit'), widgets.Size('expandToFit')]
cBlu = widgets.Canvas(f0, 'blu', sizeSpecs\
  , callbackFunction=colourMap.bluCanvasCallback, redrawOnClick=False\
  , bgColour='black', initialDrawFunction=None)


sizeSpecs = [widgets.Size('exact', 3.0, childrenJustify='centre')\
           , widgets.Size('expandToFit', childrenJustify='spread')]
f1 = widgets.Frame(gui, 'f1', sizeSpecs, isTransparent=True\
  , isEnabled=True, bgColour=None, disabledBgColour=None\
  , childSequenceDir=widgets.VERTICAL)

sizeSpecs = [widgets.Size('expandToFit'), widgets.Size('expandToFit')]
bExit = widgets.Button(f1, 'exit', sizeSpecs, 'Exit'\
  , callbackFunction=widgets.defaultExitFn, isEnabled=True\
  , bgColour=None, disabledBgColour=None, inkColour=None\
  , disabledInkColour=None)

sizeSpecs = [widgets.Size('expandToFit'), widgets.Size('expandToFit')]
bLoad = widgets.Button(f1, 'load', sizeSpecs, 'Load'\
  , callbackFunction=colourMap.loadCallback, isEnabled=True\
  , bgColour=None, disabledBgColour=None, inkColour=None\
  , disabledInkColour=None)

sizeSpecs = [widgets.Size('expandToFit'), widgets.Size('expandToFit')]
bSave = widgets.Button(f1, 'save', sizeSpecs, 'Save'\
  , callbackFunction=colourMap.saveCallback, isEnabled=True\
  , bgColour=None, disabledBgColour=None, inkColour=None\
  , disabledInkColour=None)

sizeSpecs = [widgets.Size('expandToFit'), widgets.Size('expandToFit')]
Exemple #28
0
 def load(self):
     # Initialize items
     self.quickFindButton = widgets.Button((screensize[0]/2)-(300/2), 200, 300, 100, (255, 255, 255), text="Quick find")
Exemple #29
0
 def load(self):
     self.startButton = widgets.Button((screensize[0]/2)-(300/2), 200, 300, 100, (255, 255, 255), text="Singleplayer")
     self.multiplayerButton = widgets.Button((screensize[0]/2)-(300/2), 350, 300, 100, (255, 255, 255), text="Multiplayer")
     self.backButton = widgets.Button(25, screensize[1]-75, 100, 50, (255, 255, 255), text="Quit")