本文整理汇总了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)
示例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()
示例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)
示例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()
示例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()
示例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
示例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)
示例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)
示例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
示例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))
示例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)
示例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()
示例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()
示例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
示例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 = {}