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


Python Tk.deiconify方法代码示例

本文整理汇总了Python中tkinter.Tk.deiconify方法的典型用法代码示例。如果您正苦于以下问题:Python Tk.deiconify方法的具体用法?Python Tk.deiconify怎么用?Python Tk.deiconify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tkinter.Tk的用法示例。


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

示例1: SelectDataFiles

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import deiconify [as 别名]
def SelectDataFiles():
    """Select the files to compress into a JAM"""
    # Draw (then withdraw) the root Tk window
    logging.info("Drawing root Tk window")
    root = Tk()
    logging.info("Withdrawing root Tk window")
    root.withdraw()

    # Overwrite root display settings
    logging.info("Overwrite root settings to basically hide it")
    root.overrideredirect(True)
    root.geometry('0x0+0+0')

    # Show window again, lift it so it can recieve the focus
    # Otherwise, it is behind the console window
    root.deiconify()
    root.lift()
    root.focus_force()

    # The files to be compressed
    jam_files = filedialog.askdirectory(
        parent=root,
        title="Where are the extracted LEGO.JAM files located?"
    )

    if not jam_files:
        root.destroy()
        colors.text("\nCould not find a JAM archive to compress!",
                    color.FG_LIGHT_RED)
        main()

    # Compress the JAM
    root.destroy()
    BuildJAM(jam_files)
开发者ID:le717,项目名称:PatchIt,代码行数:36,代码来源:legojam.py

示例2: selecttheIsland

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import deiconify [as 别名]
def selecttheIsland():
    """Manually select a LEGO Island installation if detection fails."""
    # Draw (then withdraw) the root Tk window
    root = Tk()
    root.withdraw()
    root.overrideredirect(True)
    root.geometry('0x0+0+0')
    root.deiconify()
    root.lift()
    root.focus_force()

    # Select the exe
    logging.info("Display file selection dialog for LEGO Island exe")
    manualGamePath = filedialog.askopenfilename(
        parent=root,
        title="Select your LEGO Island Executable (LEGOISLE.EXE)",
        defaultextension=".exe",
        filetypes=[("Windows Executable", "*.exe")]
    )

    # The user clicked the cancel button
    if not manualGamePath:
        # Give focus back to console window
        root.destroy()

        logging.warning("User did not select a LEGO Island installation!")
        print("\nCould not find a vaild LEGO Island installation!")
        main()

    # The user selected an installation
    else:
        try:
            # Display exit message
            logging.info("Display exit message")
            print("\nSee ya later, Brickulator!")

            logging.info("Run user-defined installation, located at {0}"
                         .format(manualGamePath))
            subprocess.call([manualGamePath])

            # Close app
            logging.info("{0} is shutting down".format(appName))
            raise SystemExit(0)

        # TODO I guess this works?
        except Exception:
            logging.warning("User-defined LEGO Island installation did not work!")
            print("\nCould not run {0} from {1}!".format(game, manualGamePath))

            logging.info("Re-running manual installation process")
            print("\nPlease select a new {0} installation".format(game))
            time.sleep(2)
            selecttheIsland()
开发者ID:le717,项目名称:ICU-Windower,代码行数:55,代码来源:ICUWindower.py

示例3: SelectJAMArchive

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import deiconify [as 别名]
def SelectJAMArchive():
    """Select the JAM Archive to extract"""
    # Draw (then withdraw) the root Tk window
    logging.info("Drawing root Tk window")
    root = Tk()
    logging.info("Withdrawing root Tk window")
    root.withdraw()

    # Overwrite root display settings
    logging.info("Overwrite root Tk window settings to hide it")
    root.overrideredirect(True)
    root.geometry('0x0+0+0')

    # Show window again, lift it so it can receive the focus
    # Otherwise, it is behind the console window
    root.deiconify()
    root.lift()
    root.focus_force()

    # Select the LEGO Racers installation
    logging.info("Where is the JAM archive to be extracted located?")
    jam_location = filedialog.askopenfilename(
        parent=root,
        title="Where is LEGO.JAM",
        defaultextension=".JAM",
        filetypes=[("LEGO.JAM", "*.JAM")]
    )

    if not jam_location:
        root.destroy()
        colors.text("\nCould not find a JAM archive to extract!",
                    color.FG_LIGHT_RED)
        main()

    # Extract the JAM
    root.destroy()
    ExtractJAM(jam_location)
开发者ID:le717,项目名称:PatchIt,代码行数:39,代码来源:legojam.py

示例4: SelectPiInstall

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import deiconify [as 别名]
def SelectPiInstall():
    """Searches or asks for user's PatchIt! installation"""
    # Used to detect if user needs to manually define an installation
    found_install = False

    # Path to check for PatchIt! on Windows x64
    x64_path = os.path.join(os.path.expandvars("%ProgramFiles(x86)%"), "PatchIt")

    # Path to check for PatchIt! on Windows x86
    x86_path = os.path.join(os.path.expandvars("%ProgramFiles%"), "PatchIt")

    # Perhaps the Updater is in the same place as PatchIt!.
    # In that case, use a different method for finding the installation
    same_path = os.path.join(os.path.dirname(app_folder), "Settings")

    # The updater resides in the same location as PatchIt!
    if os.path.exists(same_path):
        # It's been found, no need for user to define it
        found_install = True
        # Write the installation to file
        SavePiInstall(os.path.dirname(app_folder))

    # If this is x64 Windows, look for PatchIt in Program Files (x86)
    if os_bit:
        if os.path.exists(os.path.join(x64_path, "PatchIt.exe")):
            # It's been found, no need for user to define it
            found_install = True
            # Write the installation to file
            SavePiInstall(x64_path)

    # If this is x86 Windows, look for PatchIt in Program Files
    else:
        if os.path.exists(os.path.join(x86_path, "PatchIt.exe")):
            # It's been found, no need for user to define it
            found_install = True
            # Write the installation to file
            SavePiInstall(x86_path)

    if not found_install:
        print(
            """Could not find a valid PatchIt! installation!
Please select your PatchIt! installation."""
        )

        # Draw (then withdraw) the root Tk window
        root = Tk()
        root.withdraw()

        # Overwrite root display settings
        root.overrideredirect(True)
        root.geometry("0x0+0+0")

        # Show window again, lift it so it can receive the focus
        # Otherwise, it is behind the console window
        root.deiconify()
        root.lift()
        root.focus_force()

        # Select PatchIt.exe
        pi_path = filedialog.askopenfilename(
            parent=root, title="Where is PatchIt.exe", defaultextension=".exe", filetypes=[("PatchIt.exe", "*.exe")]
        )

        # Give focus back to console window
        root.destroy()

        # Get the directory PatchIt! is in
        pi_path = os.path.dirname(pi_path)

        # The user clicked the cancel button
        if pi_path:
            # Write the installation to file
            SavePiInstall(pi_path)
开发者ID:le717,项目名称:PatchIt,代码行数:75,代码来源:PiUpdater.py

示例5: format

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import deiconify [as 别名]
					r>>=4+1#reduce the intensity
					g>>=4+1
					b>>=4+1
					if (r,g,b)!=(0,0,0):
						fichier.write("\tdrawPixel2({},{},{},{},{},offset);\n".
												format(x,y,r,g,b) )

			fichier.write("}\n")
			if(self.AnimationVar.get()):
				fichier.write("#define ANIMATION\n")


	def upload(self):
		self.write_matrix(RESULT_PATH)
		os.system("make upload")

if __name__=="__main__":
	root = Tk()
	root.withdraw()
	my_gui = kaleidoGui(root)
	if len(argv)>1:
		my_gui.import_image(argv[1])
		my_gui.upload()
		exit(0)
	
	root.update()
	root.deiconify()
	root.mainloop()
		

开发者ID:ENAC-Robotique,项目名称:Robots,代码行数:30,代码来源:kaleidoPy.py

示例6: LRWriteSettings

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import deiconify [as 别名]
def LRWriteSettings():
    """Write PatchIt! LEGO Racers settings"""
    # Draw (then withdraw) the root Tk window
    logging.info("Drawing root Tk window")
    root = Tk()
    logging.info("Withdrawing root Tk window")
    root.withdraw()

    # Overwrite root display settings
    logging.info("Overwrite root Tk window settings to hide it")
    root.overrideredirect(True)
    root.geometry('0x0+0+0')

    # Show window again, lift it so it can receive the focus
    # Otherwise, it is behind the console window
    root.deiconify()
    root.lift()
    root.focus_force()

    # Select the LEGO Racers installation
    logging.info("Display folder dialog for LEGO Racers installation")
    new_racers_game = filedialog.askopenfilename(
        parent=root,
        title="Where is LEGORacers.exe",
        defaultextension=".exe",
        filetypes=[("LEGORacers.exe", "*.exe")]
    )

    # Get the directory the Exe is in
    new_racers_game = os.path.dirname(new_racers_game)

    # The user clicked the cancel button
    if not new_racers_game:
        # Give focus back to console window
        logging.info("Give focus back to console window")
        root.destroy()

        # Go back to the main menu
        logging.warning("User did not select a new LEGO Racers installation!")
        PatchIt.main()

    # The user selected a folder
    else:
        logging.info("User selected a new LEGO Racers installation at {0}"
                     .format(new_racers_game))

        # Give focus back to console window
        logging.info("Give focus back to console window")
        root.destroy()

        # Create Settings directory if it does not exist
        logging.info("Creating Settings directory")
        if not os.path.exists(const.settings_fol):
            os.mkdir(const.settings_fol)

        # Write settings, using UTF-8 encoding
        logging.info("Open 'Racers.cfg' for writing using UTF-8-NOBOM encoding")
        with open(os.path.join(const.settings_fol, const.LR_settings),
                  "wt", encoding="utf-8") as racers_file:

            # As partially defined in PatchIt! Dev-log #6
            # (http://wp.me/p1V5ge-yB)
            logging.info("Write line telling what program this file belongs to")
            racers_file.write("// PatchIt! V1.1.x LEGO Racers Settings\n")

            # Write brief comment explaining what the number means
            # "Ensures the first-run process will be skipped next time"
            logging.info("Write brief comment explaining what the number means")
            racers_file.write("# Ensures the first-run process will be skipped next time\n")
            logging.info("Write '1' to line 3 to skip first-run next time")
            racers_file.write("1\n")

            # Run check for 1999 or 2001 version of Racers
            logging.info("Run LRVerCheck() to find the version of LEGO Racers")
            LRVer = LRVerCheck(new_racers_game)

            logging.info("Write brief comment telling what version this is")
            racers_file.write("# Your version of LEGO Racers\n")
            logging.info("Write game version to fifth line")
            racers_file.write(LRVer)

            logging.info("Write brief comment explaining the folder path")
            racers_file.write("\n# Your LEGO Racers installation path\n")
            logging.info("Write new installation path to seventh line")
            racers_file.write(new_racers_game)

        # Log closure of file (although the with handle did it for us)
        logging.info("Closing Racers.cfg")
        logging.info("Proceeding to read LEGO Racers Settings")
        LRReadSettings()
开发者ID:le717,项目名称:PatchIt,代码行数:92,代码来源:Racers.py

示例7: GUIProgram

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import deiconify [as 别名]
class GUIProgram:
    """This is the main class that manages tkinter around the game logic.
    To run the program, instantiate this class and call the run method.
    >>> GUIProgram().run()
    """

    standard_button_dimensions = {
        'width': 2,
        'height': 1,
    }

    def __init__(self, *args):
        """Initialize core instance variables.  Note that args is not currently
        used.  It is simply available to remain consistent with the
        shell.ShellProgram class.
        """
        self.args = args
        self.app = Tk()
        self.game = None
        """:type: Game"""
        self.state = None
        """:type: Game.State"""

    # noinspection PyAttributeOutsideInit
    def run(self):
        """Begin running the GUI and initialize the game."""
        self.choose_player()
        self.window = Window(self, master=self.app)
        self.app.title('Tic Tac Toe')
        self.app.resizable(width=False, height=False)
        self.bring_to_front()
        self.app.mainloop()
        self.app.quit()

    def choose_player(self):
        """Hides the main app temporarily so the user can pick a player."""
        self.app.withdraw()
        ChoosePlayerDialog(self)

    def handle_player_choice(self, player: Player):
        """This is a callback used by the ChoosePlayerDialog class once the
        user has chosen a player.  Once executed, initializes the game and
        shows the main app to the user.
        """
        self.game = Game(player)
        self.app.deiconify()

    def handle_state(self):
        """Handle the game logic after the user has placed a move."""
        self.state = self.game.handle_state()
        if self.state in (Game.State.ComputerWins, Game.State.HumanWins):
            self.colorize_winner()
        else:
            self.window.update()

    def colorize_winner(self):
        """Highlight the buttons used to win the game."""
        player, play = self.game.get_winner_and_play()
        if player and play:
            for position in play:
                button = self.window.move_buttons[position]
                button.configure(highlightbackground='yellow')
                button.configure(background='yellow')
            self.window.update()

    def human_move(self, position):
        """Callback used by the Window class to handle moves."""
        self.game.move(self.game.human, position)

    @staticmethod
    def bring_to_front():
        """Unfortunately, OS X seems to place tkinter behind the terminal.
        Of all the methods out there, it seems like the best way to handle
        this is to make an OS call.
        """
        if sys.platform == 'darwin':
            apple_script = ('tell app "Finder" to set frontmost of process '
                            '"Python" to true')
            os.system("/usr/bin/osascript -e '{}'".format(apple_script))
开发者ID:carymrobbins,项目名称:Tic-Tac-Toe,代码行数:81,代码来源:gui.py


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