當前位置: 首頁>>代碼示例>>Python>>正文


Python gui.Gui類代碼示例

本文整理匯總了Python中gui.Gui的典型用法代碼示例。如果您正苦於以下問題:Python Gui類的具體用法?Python Gui怎麽用?Python Gui使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Gui類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: create

 def create():
     root=Tk()        
     root.columnconfigure(0, weight=1)
     root.rowconfigure(0, weight=1)
     gui = Gui(mockControl(), root)
     gui.grid(sticky=E+W+S+N)
     return (root, gui)
開發者ID:basilevs,項目名稱:varfill,代碼行數:7,代碼來源:gui.py

示例2: main

def main():

    # Construct the objects that will run the game.
    courier = Courier()
    world = World(courier)
    gui = Gui(courier, world)

    systems = [courier, world, gui]

    # Connect to the server and wait until the game is ready to begin.
    courier.setup()
    courier.login(world.setup)

    # Open up a window and get ready to start playing.
    clock = pygame.time.Clock()
    frequency = 40

    gui.setup()
    
    # Play the game!
    while world.still_playing():
        time = clock.tick(frequency) / 1000
        for system in systems:
            system.update(time)

    # Exit gracefully.
    for system in systems:
        system.teardown()
開發者ID:kxgames,項目名稱:ClayPygeons,代碼行數:28,代碼來源:client.py

示例3: __init__

 def __init__(self, mark_root, mark_travian):
     Gui.__init__(self)
     # tk
     self.root = mark_root
     # frame
     self.frame = Frame(self.root, bd=5, relief=GROOVE)
     # subframes
     self.send = Send(mark_root, mark_travian)
     self.offer = Offer(mark_root, mark_travian)
     # widgets
     self.label = Label(self.frame, text='Marketplace', font='font/Font 16 bold')
     self.margin = self.create_margin(self.frame)
開發者ID:michareichmann,項目名稱:Travian,代碼行數:12,代碼來源:market.py

示例4: main

def main():
    print 'Simulation started.'

    # Test initial table
    table_data = read_datasheet('../mdata/sample_table.data')
    shot_sequence = read_player_data('../mdata/shots.data', table_data)
    tbl = Table(table_data, shot_sequence)

    spawn(tbl.loop)

    gui = Gui(tbl, 350, 700)
    gui.start()
開發者ID:manna422,項目名稱:pool_sim,代碼行數:12,代碼來源:main.py

示例5: __init__

 def __init__(self, gui, app):
     Gui.__init__(self)
     # tk
     self.root = gui
     self.travian = app
     # items
     self.news = None
     # frame
     self.frame = Frame(self.root, bd=5, relief=GROOVE)
     # widgets
     self.labels = self.create_labels()
     self.buttons = self.create_buttons()
開發者ID:michareichmann,項目名稱:Travian,代碼行數:12,代碼來源:raid_frame.py

示例6: TPBattStat

class TPBattStat():
  def __init__(self, mode, forceDelay=None, forceIconSize=None):
    self.mode = mode
    self.forceDelay = forceDelay

    self.prefs = Prefs()
    self.battStatus = BattStatus(self.prefs)
    self.actions = Actions(self.prefs, self.battStatus)
    if self.mode == "gtk" or self.mode == "prefs":
      self.gui = Gui(self.prefs, self.battStatus)
    elif self.mode == "json" or self.mode == "dzen":
      self.guiMarkupPrinter = GuiMarkupPrinter(
        self.prefs, self.battStatus, forceIconSize)
      
  def getGui(self):
    return self.gui
  def startUpdate(self):
    self.curDelay = -1
    self.update()
  def update(self):
    try:
      self.prefs.update()
    except Exception as e:
      print 'ignoring prefs'
      print e.message
    if self.forceDelay != None:
      self.prefs['delay'] = self.forceDelay
    self.battStatus.update(self.prefs)

    self.actions.performActions()
    if self.mode == "gtk":
      self.gui.update()
    elif self.mode == "json" or self.mode == "dzen":
      try:
        if self.mode == "json":
          markup = self.guiMarkupPrinter.getMarkupJson()
        elif self.mode == "dzen":
          markup = self.guiMarkupPrinter.getMarkupDzen()
        print markup
        sys.stdout.flush()
      except IOError, e:
        print >> sys.stderr, "STDOUT is broken, assuming external gui is dead"
        sys.exit(1)

    if self.prefs['delay'] != self.curDelay:
      self.curDelay = self.prefs['delay']
      if self.curDelay <= 0:
        self.curDelay = 1000
      gobject.timeout_add(self.curDelay, self.update)
      return False
    else:
      return True
開發者ID:teleshoes,項目名稱:tpbattstat,代碼行數:52,代碼來源:tpbattstat.py

示例7: start

def start():
    while True:
        print "start"
        count = 1
        learnerarray = []
        for i in range(0,5):
            learnerarray.append(LTSBackend(count).getData())
            count = count + 1

        count = 1
        for i in learnerarray:
            Gui.setrow(win,i,count)
            count = count + 1
        sleep(10)
開發者ID:smerkousdavid,項目名稱:InternetRFIDadminclient,代碼行數:14,代碼來源:test.py

示例8: Game

class Game():
    '''A class containing all major elements of the game engine. GUI, input, draw functions, current state, save/load,
    AI, map functions, as well as settings.'''

    def __init__(self):
        '''Initializes the Game class.'''
        self.clock = pygame.time.Clock()

        # Initialize display, state
        self.display, self.state = Display(), State(self)

        # Initialize GUI and scene
        self.gui, self.scene = Gui(self), Scene(self)

        # Initialize input
        self.input = Input(self)
        self.gui.mainMenu()

    def events(self):
        '''Handles events such as input, but also ingame events which raise dialogs.'''

        # Iterate over new events
        for event in pygame.event.get():

            # Quit
            if event.type == pygame.QUIT:
                sys.exit()
            else:
                self.input.handle(event)

    def update(self):
        '''Goes through updates on the game engine and manages time.

        :return:
        '''
        # Update each sprite group.
        self.gui.widgets.update()
        self.scene.sprites.update()

        # Refresh pygame's event list.
        pygame.event.pump()

        # Keep framerate at 30 fps.
        self.clock.tick(30)

    def draw(self):
        '''Send current sprites to be drawn on the display.'''
        self.display.draw(self.gui.widgets, self.scene.sprites)
開發者ID:xeirxes,項目名稱:pydemic,代碼行數:48,代碼來源:__init__.py

示例9: __init__

 def __init__(self, _main):
     
     self.main = _main
     
     ## PHYSICS HANDLER ##
     self.physics = Physics(self)
     
     ## LEVEL LOADER ##
     self.currentLevelName = None
     self.levelloader = LevelLoader(self)
     self.currentLevelName = "startLevel2-extra"
     
     ## INPUT HANDLER
     self.input = Input(self)
     self.movementOption = '1'
     
     ## HANDLE PLAYER ##
     self.isPlayerActive = False
     self.player = {}
     self.activePlayerName = "player2"
     
     ## Start GuI ##
     self.gui = Gui(self)
     
     self.accept("doStart", self.startGame)
     
     ## GAME STATE VARIABLES ##
     self.isMoving = False
     self.isFloating = False
開發者ID:MJ-meo-dmt,項目名稱:rollin,代碼行數:29,代碼來源:game.py

示例10: Game

class Game(object):
    def __init__(self, width=1280, height=720, fps=120):
        pygame.init()

        self.width = width
        self.height = height
        self.screen = pygame.display.set_mode((width, height), pygame.DOUBLEBUF)
        self.background = pygame.Surface(self.screen.get_size()).convert()
        self.clock = pygame.time.Clock()
        self.fps = fps
        self.wave = 0

        self.font = pygame.font.Font(None, 30)
        self.score = 0

        self.event_dispatch = EventDispatcher()

        #Init all user interface staff
        self.gui = Gui()
        self.gui.set_event_dispatcher(self.event_dispatch)

        #Init all entities
        self.entities = Entities()
        self.entities.set_event_dispatcher(self.event_dispatch)

    def run(self):
        while True:
            event = pygame.event.poll()

            if event.type == pygame.QUIT:
                break

            self.clock.tick(self.fps)
            self.screen.fill(pygame.Color("#3d863d"))

            self.entities.update()
            self.gui.update()

            pygame.display.flip()

        pygame.quit()

    def display_gameover(self):
        font = pygame.font.Font(None, 72)
        text = font.render("WASTED", 1, (255, 255, 255))
        #TODO: Bad idea. Later: why? Comment more clearly
        self.screen.blit(text, (640, 360))
開發者ID:matanaliz,項目名稱:PyLand,代碼行數:47,代碼來源:main.py

示例11: ClientGame

class ClientGame (Engine):
    """ Plays the game. Does not have any game logic. It send player input to
    the server which will eventually tell the client's game what to do. """
    # Constructor {{{1
    def __init__ (self, loop, forum, world):
        print 'C: Begin game engine.'
        Engine.__init__ (self, loop)

        self.forum = forum
        self.world = world
        
        # Set up the relays.
        publisher = self.forum.get_publisher()
        subscriber = self.forum.get_subscriber()

        self.reflex = Reflex(self, subscriber, self.world)
        self.player_relay = PlayerRelay(self, publisher, self.world)

        self.gui = Gui(self.world, self.player_relay)

    def setup (self):
        self.reflex.setup()
        self.player_relay.setup()
        self.gui.setup()

        self.forum.lock()
    
    # Update {{{1
    def update (self, time):
        self.forum.update()
        self.reflex.update(time)
        self.player_relay.update(time)
        self.world.update(time)
        self.gui.update(time)

    # Methods {{{1
    def game_over(self):
        # Called by the Reflex?
        print 'Game over.'
        self.exit_engine()

    def successor (self):
        self.forum.unlock()
        return ClientPostgame(self.loop, self.forum, self.world, self.gui)
    
    def teardown (self):
        time.sleep(1)
開發者ID:alexmitchell,項目名稱:PurplePeopleEater,代碼行數:47,代碼來源:engines.py

示例12: __init__

    def __init__(self):
        self.option = "amount"
        self.options = {"amount":(5,0), "uptime":(20,0), "delay":(20,0), "alphas":self.alphas[self.alpha]}
        self.gui = Gui(self.key_event_handler)

	apply(self.gui.display_option, (), self.options)

        self.rnd = Random()
開發者ID:copton,項目名稱:spytrain,代碼行數:8,代碼來源:engine.py

示例13: __init__

	def __init__(self):
		#self.ws_server = 'users.agh.edu.pl'
		self.ws_server = 'users.dsnet.agh.edu.pl'
		self.ws_port = 10001
		
		self.gui = Gui()
		
		self.tryConnect()
開發者ID:qbajas,項目名稱:Forum-Tracker,代碼行數:8,代碼來源:client.py

示例14: __init__

 def __init__(self, gui, app):
     Gui.__init__(self)
     # tk
     self.root = gui
     self.travian = app
     # frame
     self.frame = Frame(self.root, bd=5, relief=GROOVE)
     # items
     self.news = None
     self.stringvars = self.create_stringvars()
     # widgets
     self.labels = self.create_labels()
     self.buttons = self.create_buttons()
     self.spinboxes = self.create_spinboxes()
     # bools
     self.gather_attack_info = False
     self.flash_bg = False
開發者ID:michareichmann,項目名稱:Travian,代碼行數:17,代碼來源:info_frame.py

示例15: __init__

 def __init__(self, master):
     self.gui = Gui(master)
     self.encodingerrors = []
     self.fetched_files = []
     self.used = []
     self.unused = []
     self.cssclasses = {}
     self.cssfilesnotfound = {}
     self.css_selectors = {}
開發者ID:ElanMan,項目名稱:PyCSS,代碼行數:9,代碼來源:pycss.py


注:本文中的gui.Gui類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。