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


Python Tk.lift方法代码示例

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


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

示例1: SelectDataFiles

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import lift [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: main

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import lift [as 别名]
def main() :
    """Code to read a file and assess its adherence to standards"""
    global fileDict
    
    fileDict = {}
    print("\nOpening a file—look for dialog box:")
    sys.stdout.flush()
    win = Tk() # root window for tkinter file dialog
    win.attributes('-topmost', True)
    win.withdraw() # hide root window
    win.lift() # move to front
    filename = filedialog.askopenfilename(parent=win) # get file name
    #            message="Pick a Python file to check") # label on dialog box
    win.destroy() # get rid of root window
    print("Opening file %s, assumed to be a Python file\n" % filename)
    analyzeFile(filename)

    if DEBUG_LEVEL > 0 :
        tokenParts = set(name for name in dir(tokenize) if name.isupper() 
                 and type(eval("tokenize." + name))==int) # tokenize constants
        tokenCodes = sorted([(eval("tokenize." + name),name) for 
                 name in tokenParts]) # codes corresponding to tokenParts
        print("\nTable of token codes")    
        for code, name in tokenCodes:
            print("%5d %s" % (code, name))
                                                         
    showTermination()
    return
开发者ID:jmding0714,项目名称:uiowapythonproj,代码行数:30,代码来源:checkstdandard2.py

示例3: main

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import lift [as 别名]
def main():

    root = Tk()
    root.geometry("{}x{}+{}+{}".format(700, 500, 300, 300))
    app = Window(root)
    root.lift()
    root.mainloop()
开发者ID:neale,项目名称:audio_filtering,代码行数:9,代码来源:window.py

示例4: selecttheIsland

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import lift [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

示例5: run

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import lift [as 别名]
def run(*args):
    # Create the GUI for the program
    window = Tk()
    window.wm_title("pesto_check") # change the window title to pesto_check
    text = Text(window, height=3, width=65, bg="black", padx=5, pady=5, 
            highlightthickness=1)
    text.pack()
    
    # Tag configs for green/red font color
    text.tag_config("green", foreground="green")
    text.tag_config("red", foreground="red")
    
    # Set GUI position on screen (we'll put it on the upper-right hand corner)
    window.update_idletasks() # make sure that the width is up to date
    width = window.winfo_screenwidth()
    size = tuple(int(_) for _ in window.geometry().split('+')[0].split('x'))
    x = width - size[0]
    window.geometry("%dx%d+%d+%d" % (size + (x, 0)))
    
    """Searches specified websites for pesto and outputs the results."""
    # The path to the PhantomJS executable (shown below) will need to be changed on your system
    # Example path: /Users/owenjow/pesto_check/phantomjs/bin/phantomjs
    driver = webdriver.PhantomJS("[PATH-TO-phantomjs]") ### CHANGE THIS ###
    driver.wait = WebDriverWait(driver, 5)
    
    # Search UCB dining hall menus
    search_and_output(driver, "http://goo.gl/VR8HpB", text, "DC", False)
    # Search the Cheese Board weekly menu
    search_cheeseboard_and_output(driver, text)
    # Search the Sliver weekly menu
    search_sliver_and_output(driver, text)
    
    # Bring the Tkinter window to the front
    window.lift()
    window.attributes("-topmost", True)
    
    text.configure(state="disabled") # there's no need to allow user input!
    mainloop()
    driver.quit()
开发者ID:ohjay,项目名称:pesto_check,代码行数:41,代码来源:search.py

示例6: SelectJAMArchive

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import lift [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

示例7: SelectPiInstall

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import lift [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

示例8: LRWriteSettings

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import lift [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

示例9: tkScenarist

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import lift [as 别名]
class tkScenarist (tkRAD.RADApplication):

    # class constant defs
    APP = {
        "name": _("tkScenarist"),
        "version": _("1.0.4"),
        "description": _("Movie scriptwriting utility program."),
        "title": _("tkScenarist - screen writing made simpler"),
        "author": _("Raphaël SEBAN <[email protected]>"),
        # current maintainer (may be different from author)
        "maintainer": _("Raphaël SEBAN"),
        "copyright": _("(c) 2014+ Raphaël SEBAN."),
        "license": _("""\
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.

This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.

You should have received a copy of the GNU General Public License along
with this program.

If not, see: http://www.gnu.org/licenses/
        """).strip(),
        "license_url": _("http://www.gnu.org/licenses/"),
        "pdflib": _("ReportLab®"),
        "pdflib_author": _("(c) ReportLab Europe Ltd. 2000-2012"),
    } # end of APP

    DIRECTORIES = (
        "data", "etc", "html", "locale", "reportlab", "src", "tkRAD",
        "xml",
    ) # end of DIRECTORIES

    PYTHON = {
        "version": "3.3",
        "strict": False,
    } # end of PYTHON

    RC_OPTIONS = {
        "user_file": "user_options.rc",
        "user_dir": "^/etc",
        "app_file": "application.rc",
        "app_dir": "^/etc",
    } # end of RC_OPTIONS


    def _start_gui (self, **kw):
        # tkinter root window inits
        self.init_root_window()
        # splash screen inits
        self.init_splash_screen()
        # show splash screen
        self.show_splash_screen()
        # application main window inits (tkRAD - GUI)
        import src.mainwindow as MW
        self.mainwindow = MW.MainWindow(**kw)
        self.mainwindow.run()
    # end def


    def hide_splash_screen (self, *args, **kw):
        """
            event handler: hides application's splash screen;
        """
        try:
            self.splash.hide()
        except:
            pass
        # end try
    # end def


    def init_root_window (self, *args, **kw):
        """
            event handler: sets up the Tk() root window;
        """
        # lib imports
        from tkinter import Tk
        # tkinter root window inits
        self.root = Tk()
        # hide this ugly window
        self.root.withdraw()
        # raise above all (MS-Win fixups)
        self.root.lift()
    # end def


    def init_splash_screen (self, *args, **kw):
        """
            event handler: sets up a generic splash screen;
        """
        # lib imports
        from src import splash_screen as SP
        # inits
        self.splash = SP.SplashScreen(
#.........这里部分代码省略.........
开发者ID:PabloSajnovsky,项目名称:tkScenarist,代码行数:103,代码来源:tkscenarist.py


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