コード例 #1
0
ファイル: widget.py プロジェクト: Sankluj/PyWidget
    def __init__(self, x=0, y=0, z=0, width=100, height=100,
                 anchor_x='left', anchor_y='bottom', *args, **kwargs):
        ''' Create a displayable widget.

        :Parameters:
            `x` : float
                X coordinate of the widget relative to anchor_x.
            `y` : float
                Y coordinate of the widget relative to anchor_y.
            `z` : float
                Z coordinate of the widget plane.
            `width` : int
                Width of the widget.
            `height` : int
                Height of the widget.
            `anchor_x` : str
                Horizontal alignment of the widget.
                See `Widget.anchor_x` for details.
            `anchor_y` : str
                Vertical alignment of the widget.
                See `Widget.anchor_y` for details.
        '''
        EventDispatcher.__init__(self)
        self._x, self._y, self._z = x, y, z
        self._root_x, self._root_y, self._root_z = 0,0,0
        self._width = width
        self._height = height
        self.anchor_x = anchor_x
        self.anchor_y = anchor_y
        self._children = []
        self._elements = {}
        self._moveable = True
        self._focusable = True
        self._sizeable = True
        self._hidden = False
コード例 #2
0
    def __init__(self):
        EventDispatcher.__init__(self)
        assert isinstance(self._event_stack, tuple)
        self._event_stack = [self.default_event_handlers]

        # list of elements that have responded to an on_element_enter event
        self.entered_elements = []
コード例 #3
0
ファイル: event.py プロジェクト: bitcraft/pyglet
    def __init__(self):
        EventDispatcher.__init__(self)
        assert isinstance(self._event_stack, tuple)
        self._event_stack = [self.default_event_handlers]

        # list of elements that have responded to an on_element_enter event
        self.entered_elements = list()
コード例 #4
0
ファイル: lesson1.py プロジェクト: msarch/py
    def __init__(self, client):
        EventDispatcher.__init__(self)
        self.client = client

        # We need to keep track of which block we are pressing (if any). This
        # way we can have it so you have to press on and let up on a block
        # before it registers. (which is important as that's how people's
        # software works and how they expect the game to work)
        self.pressed_block = None
コード例 #5
0
ファイル: player.py プロジェクト: Krzycho/python-shooter
    def __init__(self, image=None):
        if image is None:
            image = ResourceManager.get_player_image()

        ShootingSprite.__init__(self, image, rotation=90, bound_to_window=True)
        EventDispatcher.__init__(self)

        self.health = 100
        self.max_health = 100
        self.armor = None
        self.missle_damage = 10
        self.hit_damage = 100
        self.score = 0
        self.detonate = True
コード例 #6
0
ファイル: enemy_layer.py プロジェクト: Krzycho/python-shooter
    def __init__(self):
        Layer.__init__(self)
        EventDispatcher.__init__(self)

        self.waves = []
        self.current_wave = None
        self.wave_delay = 3
        self.countdown_label = None
        self.countdown_texts = []
        self.is_started = False
        self.is_next_wave_notified = False
        self.is_enemies_deployed = False
        self.next_level_notified = False
        self.bonuses = []
コード例 #7
0
 def __init__(self):
     """initializer"""
     EventDispatcher.__init__(self)
     self.config = Config()
     events_to_register = ["switch_break", 
                           "switch_direction",
                           "city", 
                           "show_event",
                           "show_train_display",
                           "mainmenu",
                           "modify_speed", 
                           "return_to_map", 
                           "find_engine", 
                           "minimap", 
                           "shovel", 
                           "show_worldmap", 
                           "show_combat", 
                           "speed_was_modified",
                           "speedregulator",
                           "start_game", 
                           "quick_battle", 
                           "sound_switch",
                           "load_game", 
                           "commerce_switch_trade_dump", 
                           "service_switch_wagons",
                           "service_repair_wagons",
                           "show_city_display",
                           "wagon_select",
                           "wagon_buy",
                           "wagon_sell",
                           "item_buy",
                           "item_sell",
                           "wagon_service",
                           "scroll_minitrain",
                           "menu_adjutant",
                           "close_inventory",
                           "build_bridge",
                           "coal_mining",
                           "mammoth_hunt",
                           "do_save",
                           "switch_sound_switch",
                           "menu_xo",
                           "tavern_talk"]
     for event in events_to_register:
         self.register_event_type(event)
コード例 #8
0
ファイル: base.py プロジェクト: naymen/MELA
 def __init__(self, x=0, y=0):
     EventDispatcher.__init__(self)
     self.pos = Vec(x, y)
コード例 #9
0
ファイル: base.py プロジェクト: naymen/MELA
 def __init__(self, x=0, y=0, w=0, h=0):
     EventDispatcher.__init__(self)
     self.pos = Vec(x, y)
     self.width = w
     self.height = h
コード例 #10
0
ファイル: main.py プロジェクト: msarch/py
 def __init__(self, **kwargs):
     Widget.__init__(self, **kwargs)
     EventDispatcher.__init__(self)
     if not self.bounds:
         self.bounds = "always"
     self.is_focused = True
コード例 #11
0
ファイル: astar.py プロジェクト: brandonl/a-maze
 def __init__( self, client ):
     EventDispatcher.__init__(self)
     self.client 	= client
     self.setStart 	= False
     self.setEnd 	= False
     self.erase		= False
コード例 #12
0
ファイル: main.py プロジェクト: msarch/py
 def __init__(self, **kwargs):
     Widget.__init__(self, **kwargs)
     EventDispatcher.__init__(self)
     if not self.bounds:
         self.bounds = "always"
     self.is_focused = True
コード例 #13
0
ファイル: actor.py プロジェクト: Ecialo/Codename-Parzalon
 def __init__(self, master):
     EventDispatcher.__init__(self)
     self.master = master
     self.owner = master