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


Python GUI類代碼示例

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


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

示例1: __init__

 def __init__(self, config):
     self.text = config.get('text', '')
     if config.get('color', False):
         self.color = '\c' + config.get('color')[1:] + 'FF;'
     self.visible = config.get('visible', True)
     self.x  = config.get('x', 0)
     self.y  = config.get('y', 0)
     self.hcentered  = config.get('hcentered', False)
     self.vcentered  = config.get('vcentered', False)
     background = os.path.join('scripts', 'client', 'mods', config.get('background')) \
         if config.get('background', '') else ''
     self.window = GUI.Window(background)
     self.window.materialFX = "BLEND"
     self.window.verticalAnchor = "TOP"
     self.window.horizontalAnchor = "LEFT"
     self.window.horizontalPositionMode = 'PIXEL'
     self.window.verticalPositionMode = 'PIXEL'
     self.window.heightMode = 'PIXEL'
     self.window.widthMode = 'PIXEL'
     self.window.width = config.get('width', 186)
     self.window.height = config.get('height', 32)
     GUI.addRoot(self.window)
     self.shadow = GUI.Text('')
     font = config.get('font', 'default_medium.font')
     self.installItem(self.shadow, font)
     self.label = GUI.Text('')
     self.installItem(self.label, font)
     self.setVisible(self.visible)
開發者ID:wotmods,項目名稱:wothp,代碼行數:28,代碼來源:totalhp.py

示例2: getUser

def getUser(username_local, server_name_local):
	#連接服務器
	try:
		sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
		sock.connect((server_name, remote_server_port))
		sock.settimeout(15)
	#檢測服務器是否關閉
	except socket.timeout:
		print "Error:timeout"
		return None
	sock.send('{"action":"login","uid":0,"username":"%s","ip":"%s"}' %(username_local,server_name_local))
	userdata = sock.recv(1024)
	print userdata
	u = user.user()
	u.set(json.loads(userdata))
	while True:
		print "[FLOATER FIND] try to find fellow"
		sock.send('{"action":"find"}')
		fellow = sock.recv(1024)
		if fellow != "None":
			print "[FLOATER FOUND]", fellow
			userData = json.loads(fellow)
			u.set(userData)
			break
		time.sleep(5)
	sock.send('{"action":"close"}')
	sock.close()
	GUI.setRemote(u)
開發者ID:smail1229,項目名稱:computer-network,代碼行數:28,代碼來源:login.py

示例3: __onMenuShow

 def __onMenuShow(self, mouseUsedForShow):
     if not self.__ingameMenuIsVisible():
         screenWidth = BigWorld.screenWidth()
         screenHeight = BigWorld.screenHeight()
         guiScreenWidth, guiScreenHeight = GUI.screenResolution()
         ratioWidth = float(guiScreenWidth / screenWidth)
         ratioHeight = float(guiScreenHeight / screenHeight)
         self.call('RadialMenu.setRatio', [ratioWidth, ratioHeight])
         crosshairType = self.__getCrosshairType()
         keys = self.__getKeysList(crosshairType)
         self.GUICtrl.setFireKeyCode(self.__getFireKeyCode())
         self.GUICtrl.setState(crosshairType)
         self.GUICtrl.updateKeys(keys)
         screenWidth, screenHeight = GUI.screenResolution()
         ctrl = g_sessionProvider.shared.crosshair
         if ctrl is not None:
             mouseLeft, mouseTop = ctrl.getOffset()
         else:
             mouseLeft, mouseTop = (0.0, 0.0)
         x = round(screenWidth / 2.0 * mouseLeft)
         y = -round(screenHeight / 2.0 * mouseTop)
         offset = (x, y)
         self.__showed = True
         self.GUICtrl.show(offset, mouseUsedForShow)
     return
開發者ID:aevitas,項目名稱:wotsdk,代碼行數:25,代碼來源:legacyradialmenu.py

示例4: on_init

 def on_init(self, controller):
     print "Initialized"
     self.circleCount = 0;
     self.window = None; 
     self.menu = None;
     self.menu_window = None;
     GUI.init()
開發者ID:SimonTheCoder,項目名稱:LordSimonMotion,代碼行數:7,代碼來源:LordSimonMotion.py

示例5: showFDFont

def showFDFont():
    s = GUI.Simple('')
    s.position = (0, 0, 0)
    GUI.addRoot(s)
    s.materialFX = 'SOLID'
    s.textureName = 'fantasydemofont_20_font_rt'
    s.size = (2, 2)
開發者ID:webiumsk,項目名稱:WOT-0.9.14-CT,代碼行數:7,代碼來源:fonts.py

示例6: updateState

	def updateState( self, dTime ):		
		GUI.update( dTime )
		self.cc.update( dTime )
		BigBang.update( dTime )
		BigBang.camera().update( dTime )
		BigBang.fudgeOrthographicMode( 1500.0, 0.01 )
		return 1
開發者ID:siredblood,項目名稱:tree-bumpkin-project,代碼行數:7,代碼來源:ChunkManager.py

示例7: buttonClicked

 def buttonClicked(self):
     t = GUI.Text('Button Clicked!')
     t.colour = (255, 0, 0, 255)
     t.position.y = 0.85
     t.verticalAnchor = 'TOP'
     GUI.addRoot(t)
     BigWorld.callback(2.5, partial(_deleteComponent, t))
開發者ID:aevitas,項目名稱:wotsdk,代碼行數:7,代碼來源:pyguitest.py

示例8: forceShowCursor

def forceShowCursor(show):
    if show:
        BigWorld.setCursor(GUI.mcursor())
        GUI.mcursor().visible = True
    else:
        BigWorld.setCursor(BigWorld.dcursor())
        GUI.mcursor().visible = False
開發者ID:webiumsk,項目名稱:WOT-0.9.12,代碼行數:7,代碼來源:cursor.py

示例9: __init__

	def __init__(self, parent, describtion="Working..."):
		self.parent = parent

		# init popup dialog
		GUI.Toplevel.__init__(self, parent, takefocus=True)
		self.wm_title(describtion)
		self.transient(parent)
		self.resizable(0,0)

		# add some text
		label = GUI.Label(self, text="progress:")
		label.pack(fill='both', expand=1, padx=2, pady=2)

		# init progress bar
		self.progress_bar = GUI.Progressbar(self, orient='horizontal', length=300, mode='determinate')
		self.progress_bar.pack(fill='both', expand=1, padx=2, pady=2)

		# put window in front of others (popup-action)
		self.lift()
		self.grab_set()
		self.focus_set()
		self.set_maximum(100)
		self.set_progress(0)

		# center window into the center of the parent window
		GUI.center_window(self, parent)
開發者ID:COMSYS,項目名稱:PowerGraph,代碼行數:26,代碼來源:dialogs.py

示例10: showFDFont

def showFDFont():
    s = GUI.Simple("")
    s.position = (0, 0, 0)
    GUI.addRoot(s)
    s.materialFX = "SOLID"
    s.textureName = "fantasydemofont_20_font_rt"
    s.size = (2, 2)
開發者ID:aevitas,項目名稱:wotsdk,代碼行數:7,代碼來源:bwobsolete_testsfonts.py

示例11: launch

def launch(spaceName):
    global g_offlineModeEnabled
    global g_spaceID
    global g_videoCamera
    print 'Entering offline space', spaceName
    BigWorld.clearAllSpaces()
    BigWorld.worldDrawEnabled(False)
    _displayGUI(spaceName)
    g_spaceID = BigWorld.createSpace()
    BigWorld.addSpaceGeometryMapping(g_spaceID, None, spaceName)
    BigWorld.setCursor(GUI.mcursor())
    GUI.mcursor().visible = False
    GUI.mcursor().clipped = True
    g_offlineModeEnabled = True
    BigWorld.callback(1.0, _offlineLoadCheck)
    rootSection = ResMgr.openSection(AvatarInputHandler._INPUT_HANDLER_CFG)
    videoSection = rootSection['videoMode']
    videoCameraSection = videoSection['camera']
    g_videoCamera = VideoCamera(videoCameraSection)
    g_videoCamera.enable(camMatrix=mathUtils.createTranslationMatrix((0.0, 0.0, 0.0)))
    BigWorld.camera().spaceID = g_spaceID
    import game
    game.handleKeyEvent = handleKeyEvent
    game.handleMouseEvent = handleMouseEvent
    BigWorld.player = lambda : g_fakeAvatar
    return
開發者ID:webiumsk,項目名稱:WOT-0.9.12-CT,代碼行數:26,代碼來源:offlinemode.py

示例12: __destroyGUI

 def __destroyGUI(self):
     assert self._guiName.parent is None
     assert self._guiValue.parent is None
     GUI.delRoot(self._guiName)
     self._guiName = None
     GUI.delRoot(self._guiValue)
     self._guiValue = None
開發者ID:kblw,項目名稱:wot_client,代碼行數:7,代碼來源:debugview.py

示例13: new_game

def new_game():
    global player, inventory, game_msgs, game_state, dungeon_level

    #create object representing the player
    entity_component = Entity(5)
    GameState.player = Object(0, 0, '@', 'player', libtcod.white, blocks=True, entity=entity_component)

    GameState.player.level = 1

    #generate map (at this point it's not drawn to the screen)
    dungeon_level = 1
    Map.make_map()
    initialize_fov()

    game_state = 'playing'
    GameState.inventory = []

    #create the list of game messages and their colors, starts empty
    GameState.game_msgs = []

    #a warm welcoming message!
    GUI.message('Welcome stranger! Prepare to perish in the Tombs of the Ancient Kings.', libtcod.red)

    #initial equipment: a dagger
    equipment_component = Equipment(slot='right hand', power_bonus=2)
    obj = Object(0, 0, '-', 'dagger', libtcod.sky, equipment=equipment_component)
    GameState.inventory.append(obj)
    equipment_component.equip()
    obj.always_visible = True
開發者ID:edrobot,項目名稱:PythonRoguelike_Spring-2014,代碼行數:29,代碼來源:GameFlow.py

示例14: rebuild

    def rebuild(self):
        saved_parent = self.getParent()
        saved_position = self.getPosition()
        saved_size = self.getSize()
        saved_textureName = self.getTextureName()
        saved_visible = self.getVisible()
        for curItem in self.__dictItems.itervalues():
            self.__window.delChild(curItem._guiName)
            self.__window.delChild(curItem._guiValue)

        GUI.delRoot(self.__window)
        self.__window = None
        for curItem in self.__dictItems.itervalues():
            curItem._rebuild()

        self.__createMainWindow(saved_parent)
        self.setPosition(saved_position)
        self.setSize(saved_size)
        self.setTextureName(saved_textureName)
        self.setVisible(saved_visible)
        for curItem in self.__dictItems.itervalues():
            self.__window.addChild(curItem._guiName)
            self.__window.addChild(curItem._guiValue)

        if self.__bAutoUpdate:
            self.update()
        return
開發者ID:webiumsk,項目名稱:WOT-0.9.14-CT,代碼行數:27,代碼來源:debugview.py

示例15: __destroyMainWindow

 def __destroyMainWindow(self):
     if self.__window.parent is not None:
         self.__window.parent.delChild(self.__window)
     else:
         GUI.delRoot(self.__window)
     self.__window = None
     return
開發者ID:webiumsk,項目名稱:WOT-0.9.14-CT,代碼行數:7,代碼來源:debugview.py


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