当前位置: 首页>>代码示例>>Python>>正文


Python UI类代码示例

本文整理汇总了Python中UI的典型用法代码示例。如果您正苦于以下问题:Python UI类的具体用法?Python UI怎么用?Python UI使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了UI类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: doBuyWeapon

    def doBuyWeapon(self, Player):
        ShopWaresMenu = UI.MenuClass()
        ShopWaresMenu.Title = "Weapons"

        # Do bying menu
        while not ShopWaresMenu.Returned:
            # Fill with with items & information and trade-in value
            ShopWaresMenu.clear()
            for ShopItem in self.WeaponList:
                Name = ShopItem.descString()
                ShopWaresMenu.addItem(Name)
            ShopWaresMenu.CustomText = (
                "You have " + str(Player.Gold) + " gp\nYour weapon: " + Player.Equipment["Weapon"].Base.descString()
            )

            Index = ShopWaresMenu.doMenu()
            if ShopWaresMenu.Returned:
                break

            ShopItem = self.WeaponList[Index]
            if Player.Gold < ShopItem.Value:
                print("You cannot afford that!")
                UI.waitForKey()
                continue

            # Secure the transaction
            self.WeaponList.remove(ShopItem)
            Player.addItem(ShopItem)
            Player.Gold -= ShopItem.Value
            print(ShopItem.Name, "bought")
            UI.waitForKey()
开发者ID:mildbyte,项目名称:console-massacre,代码行数:31,代码来源:Shop.py

示例2: remove_game

def remove_game(_=None):
    """Remove the currently-chosen game from the game list."""
    global selected_game
    lastgame_mess = (
        "\n (BEE2 will quit, this is the last game set!)"
        if len(all_games) == 1 else
        ""
    )
    confirm = messagebox.askyesno(
        title="BEE2",
        message='Are you sure you want to delete "'
                + selected_game.name
                + '"?'
                + lastgame_mess,
        )
    if confirm:
        selected_game.edit_gameinfo(add_line=False)

        all_games.remove(selected_game)
        config.remove_section(selected_game.name)
        config.save()

        if not all_games:
            UI.quit_application()  # If we have no games, nothing can be done

        selected_game = all_games[0]
        selectedGame_radio.set(0)
        add_menu_opts(game_menu)
开发者ID:xDadiKx,项目名称:BEE2.4,代码行数:28,代码来源:gameMan.py

示例3: main

def main():
	my_persons = PersonRepository()
	my_activities = ActivityRepository()
	my_Controller = Controller(my_persons, my_activities)

	my_UI = UI(my_Controller)
	my_UI.do_menu()
开发者ID:ovidiucota,项目名称:FP,代码行数:7,代码来源:app.py

示例4: main

def main():
    # The topLevelObjects is a list to store objects at the top level to listen for events.
    # A typical use should only have the navigationViewController inside it as the subclasses manage events
    global topLevelObjects      # Allow for the topLevelObjects list to be used elsewhere
    topLevelObjects = []

    # Initialise screen and pyGame
    pygame.init()
    screen = pygame.display.set_mode((800, 600))
    # Set the window title
    pygame.display.set_caption('Squares')

    # initialisation of the navigation controller.
    navigationViewController = NWPi.navigationController(screen)             # Create a navigation view controller. Will parent all the Viewcontrollers
    topLevelObjects.append(navigationViewController)                    # This will now be added to topLevelObjects so it can recieve events

    # draw each viewController to the navigation controller
    home = UI.homeViewController(navigationViewController)                 # Create a ViewController, from subclass homeViewController where all elements are already defined
    navigationViewController.addSubView("HOMEVIEWCONTROLLER", home)     # Add the ViewController to the navigation Controller. Do the same with the rest.

    secondView = UI.instructionsViewController(navigationViewController)
    navigationViewController.addSubView("INSTRUCTIONS", secondView)

    gameView = UI.mainGameViewController(navigationViewController)
    navigationViewController.addSubView("GAMEVIEW", gameView)

    # We need to set a viewController to show as the top level. Choose it here:
    navigationViewController.makeKeyAndVisible("INSTRUCTIONS")    # Tell the navigation controller to set the view with the specified identifier to the top

    # We need a loop to keep the script running. Defining it here
    while True:
        loop()  # Run the loop() function we defined earlier.
开发者ID:nickw444,项目名称:NWPi,代码行数:32,代码来源:game.py

示例5: __init__

    def __init__(self, parent=None):
        QtGui.QMainWindow.__init__(self,parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        
        sys.stdout=StdoutRedirector(self.ui.console)

        #### 1: ROADMAP ####
        UI.setRoadmapGUI(self)
        self.ui.roadmap_widget.hide()
        self.ui.roadmap_Run.clicked.connect(self.start_roadmap)
        
        self.createTable("roadmap")
        self.ui.roadmap_table.hide()
        self.ui.roadmap_Options.clicked.connect(self.ui.roadmap_table.show)
        self.ui.roadmap_Options.clicked.connect(self.ui.roadmap_save_button.show)
        self.ui.roadmap_save_button.clicked.connect(self.saveOptions)
        #### 2: POLYGONS ####
        UI.setPolygonsGUI(self)
        self.ui.polygons_widget.hide()
        self.ui.polygons_Run.clicked.connect(self.start_polygons)
        
        #### 3: BUILDING_GENERATION ####
        self.ui.building_generation_Run.clicked.connect(UI.building_generation)
        
        #### 4: VISUALIZATION ####
        self.ui.visualization_Run.clicked.connect(UI.visualization)
开发者ID:omegaluo,项目名称:procedural_city_generation,代码行数:27,代码来源:GUI.py

示例6: doBuyArmor

    def doBuyArmor(self, Player):
        """Initializes armor buy dialogue with player"""
        # Generate shop inventory menu
        ShopWaresMenu = UI.MenuClass()
        ShopWaresMenu.Title = "Armor"

        while not ShopWaresMenu.Returned:
            # Fill with with items & information and trade-in value
            ShopWaresMenu.clear()

            for ShopItem in self.ArmorList:
                Name = ShopItem.descString()
                ShopWaresMenu.addItem(Name)
            ShopWaresMenu.CustomText = (
                "You have " + str(Player.Gold) + " gp\nYour armor: " + Player.Equipment["Armor"].Base.descString()
            )

            Index = ShopWaresMenu.doMenu()
            if ShopWaresMenu.Returned:
                break

            ShopItem = self.ArmorList[Index]
            if Player.Gold < ShopItem.Value:
                print("You cannot afford that!")
                UI.waitForKey()
                continue

            # Secure the transaction
            self.ArmorList.remove(ShopItem)
            Player.Gold -= ShopItem.Value
            Player.addItem(ShopItem)
            print(ShopItem.Name, "bought")
            UI.waitForKey()
开发者ID:mildbyte,项目名称:console-massacre,代码行数:33,代码来源:Shop.py

示例7: doExamine

    def doExamine(self, Player):
        """Starts cell object examination dialogue"""
        while 1:
            ObjectMenu = UI.MenuClass()
            ObjectMenu.Title = "Objects"
            for Object in self.Items:
                ObjectMenu.addItem(Object.Name)

            Choice = ObjectMenu.doMenu()
            if ObjectMenu.Returned: break

            Chosen = self.Items[Choice]

            print(Chosen.descString())
            ChosenMenu = UI.MenuClass()
            ChosenMenu.DoCLS = 0
            ChosenMenu.addItem("Take", UI.emptyCallback, "t")

            Choice = ChosenMenu.doMenu()
            if ChosenMenu.Returned: continue

            if Choice == 0:
                self.Items.remove(Chosen)
                Player.Inventory.addItem(Chosen)
                print("You take", Chosen.Name)
                UI.waitForKey()
开发者ID:mildbyte,项目名称:console-massacre,代码行数:26,代码来源:World.py

示例8: contract

def contract(_):
    """Shrink the filter view."""
    global is_expanded
    is_expanded = False
    wid["expand_frame"].grid_remove()
    snd.fx("contract")
    UI.flow_picker()
开发者ID:BenVlodgi,项目名称:BEE2.4,代码行数:7,代码来源:tagsPane.py

示例9: save

def save():
    """Saves user character progress, returns 0 on success, -1 on failure"""
    global Player

    FileName = UI.xInput("Enter filename to save to (default: player.dat): ", "player.dat")
    FileName = "".join(("saves/", FileName))
    
    try:

        if os.path.exists(FileName):
            if input("Warning! File already exists. Type \'yes\' if you want to continue: ") != "yes":
                return 0

        Out = open(FileName, "wb")
        pickle.dump(Player, Out)
        Out.close()
        
    except Exception:
        print ("Error: " + sys.exc_info()[0])
        UI.waitForKey()
        return -1

    print("Complete")
    UI.waitForKey()
    return 0
开发者ID:mildbyte,项目名称:console-massacre,代码行数:25,代码来源:main.py

示例10: load

def load():
    global selected_game
    all_games.clear()
    for gm in config:
        if gm != 'DEFAULT':
            try:
                new_game = Game(
                    gm,
                    int(config[gm]['SteamID']),
                    config[gm]['Dir'],
                )
            except ValueError:
                pass
            else:
                all_games.append(new_game)
                new_game.edit_gameinfo(True)
    if len(all_games) == 0:
        # Hide the loading screen, since it appears on top
        loadScreen.main_loader.withdraw()

        # Ask the user for Portal 2's location...
        if not add_game(refresh_menu=False):
            # they cancelled, quit
            UI.quit_application()
        loadScreen.main_loader.deiconify()  # Show it again
    selected_game = all_games[0]
开发者ID:xDadiKx,项目名称:BEE2.4,代码行数:26,代码来源:gameMan.py

示例11: filter_items

def filter_items():
    """Update items based on selected tags."""
    show_wip = optionWindow.SHOW_WIP.get()
    style_unlocked = StyleVarPane.tk_vars['UnlockDefault'].get() == 1

    # any() or all()
    func = TAG_MODES[TAG_MODE.get()]

    sel_tags = [
        tag
        for tag, enabled
        in TAGS.items()
        if enabled
    ]
    no_tags = len(sel_tags) == 0

    for item in UI.pal_items:
        if item.needs_unlock and not style_unlocked:
            item.visible = False
            continue
        if item.item.is_wip and not show_wip:
            item.visible = False
            continue

        if no_tags:
            item.visible = True
        else:
            item_tags = item.item.filter_tags
            item.visible = func(
                tag in item_tags
                for tag in
                sel_tags
            )
    UI.flow_picker()
开发者ID:Coolasp1e,项目名称:BEE2.4,代码行数:34,代码来源:tagsPane.py

示例12: run

def run() -> None:
    """Initializes program"""
    # global corpus
    # may want to load excel files on a case by case basis later on
    if load_excel_files:
        print("Loading excel files...")
        excel_setup()
        print("Done")
    UI.setup()
    # if corpus != None:
    # corpus = eval(corpus)
    # UI.return_data(analyze(word))
    print(
        """
Notes: some 2 part words can be analyzed, however, the results
       - of the analysis of such words may be inconsistant depending on
       - whether the input uses a space or an underscore to seperate them
       entering default as an option when it is available will run the
       - given function using a set of predetermined common words
       - (see common words.txt)"""
    )
    while True:
        interface_data = UI.interface()
        if interface_data[0] == "quit":
            break
        elif interface_data == (None, None):
            continue
        UI.output_data(collect_data(interface_data))
    return
开发者ID:gracecl,项目名称:Project,代码行数:29,代码来源:controller.py

示例13: breed

 def breed(self, mate):
     if not mate.breedable():
         return
     for partner in self.crew:
         # no sterile or pregnant partners
         if not partner.breedable():
             continue
         if partner.sex == mate.sex:
             continue
         # no fathers or mothers
         if partner.crew_id == mate.mom.crew_id or partner.crew_id == mate.dad.crew_id:
             continue
         if mate.crew_id == partner.mom.crew_id or mate.crew_id == partner.dad.crew_id:
             continue
         prob = .006
         # half siblings and full siblings
         if mate.dad.crew_id == partner.dad.crew_id:
             prob *= .01
         if mate.mom.crew_id == partner.mom.crew_id:
             prob *= .01
         if random.random() < prob:
             baby = Crewmate()
             mate.breeding = True
             partner.breeding = True
             if mate.sex == Sex.Male:
                 baby.be_born(mate, partner)
             else:
                 baby.be_born(partner, mate)
             self.crew.append(baby)
             print UI.inline_print(baby)+" has been born."
             print "Their parents are "+mate.name+" and "+partner.name
             return
开发者ID:RarefactionQ,项目名称:Genesis,代码行数:32,代码来源:Ship.py

示例14: downloadCurrentVersionUI

def downloadCurrentVersionUI(filename,secondary_dir,file_type,root):
    continue_analysis = downloadCurrentVersion(filename,secondary_dir,file_type)
    if continue_analysis == 'no' and 'nnot' not in filename:
        import UI
        try: root.destroy(); UI.getUserParameters('no'); sys.exit()
        except Exception: sys.exit()
    try: root.destroy()
    except Exception(): null=[] ### Occurs when running from command-line
开发者ID:venkatmi,项目名称:altanalyze,代码行数:8,代码来源:update.py

示例15: expand

def expand(_):
    """Expand the filter view."""
    global is_expanded
    is_expanded = True
    wid["expand_frame"].grid(row=2, column=0, columnspan=2, sticky="NSEW")
    wid["tag_list"]["height"] = TK_ROOT.winfo_height() / 48

    snd.fx("expand")
    UI.flow_picker()
开发者ID:BenVlodgi,项目名称:BEE2.4,代码行数:9,代码来源:tagsPane.py


注:本文中的UI类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。