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


Python Tk.withdraw方法代码示例

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


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

示例1: copy_helper

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import withdraw [as 别名]
def copy_helper(text):
    '''I have no idea what I'm doing here, but it seems to work ¯\_(ツ)_/¯'''
    r = Tk()
    r.withdraw()
    r.clipboard_clear()
    r.clipboard_append(text)
    r.destroy()
开发者ID:willxyu,项目名称:pymudclient,代码行数:9,代码来源:gtkgui.py

示例2: get_file

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import withdraw [as 别名]
 def get_file(self):
     root = Tk()
     root.withdraw()
     root.update()
     input_file = tkFileDialog.askopenfilename(parent=root)
     root.destroy()
     return input_file
开发者ID:hongtron,项目名称:braintree-refunder,代码行数:9,代码来源:input_helper.py

示例3: copyToClipboard

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import withdraw [as 别名]
 def copyToClipboard(self, text):
     from Tkinter import Tk
     w = Tk()
     w.withdraw()
     w.clipboard_clear()
     w.clipboard_append(text)
     w.destroy()
开发者ID:GCTMODS,项目名称:joan-s-x-plane-python-scripts,代码行数:9,代码来源:PI_FastPlan.py

示例4: createRoot

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import withdraw [as 别名]
def createRoot():
    """ create a root and hide it
"""
    from Tkinter import Tk
    root = Tk()
    root.withdraw()
    return root
开发者ID:MolecularFlipbook,项目名称:FlipbookApp,代码行数:9,代码来源:__init__.py

示例5: getClipboardText

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import withdraw [as 别名]
def getClipboardText():
    from Tkinter import Tk
    r = Tk()
    r.withdraw()
    s = r.clipboard_get()
    r.destroy()
    return s
开发者ID:kleopatra999,项目名称:downpoured_scite_editor,代码行数:9,代码来源:filesystem.py

示例6: main

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import withdraw [as 别名]
def main():
    base_path = os.path.dirname(os.path.abspath(__file__))
    version_file = os.path.join(base_path, "VERSION")
    idlelib.PyShell.PyShell.shell_title = "Another Springnote"
    if os.path.exists(version_file):
        idlelib.PyShell.PyShell.shell_title += " (ver. {})".format(open(version_file).read().strip())
    root = Tk(className="Idle")
    fixwordbreaks(root)
    root.withdraw()
    flist = PyShellFileList(root)
    idlelib.macosxSupport.setupApp(root, flist)
    flist.open_shell()
    shell = flist.pyshell
    if not shell:
        return
    shell.interp.runcommand(
        """if 1:
        import sys as _sys
        _sys.argv = %r
        del _sys
        \n"""
        % (sys.argv,)
    )
    script_path = os.path.normpath(os.path.join(base_path, "run.py"))
    shell.interp.prepend_syspath(script_path)
    shell.interp.execfile(script_path)
    root.mainloop()
    root.destroy()
开发者ID:sabal,项目名称:another-springnote,代码行数:30,代码来源:shell.py

示例7: main

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import withdraw [as 别名]
def main():
  aList = []
  check = 'y'
  clipOut = ""

  print ""  
  print "***************************"
  print "*  Calendar List Builder  *"
  print "*  Updated:  09/13/2013   *"
  print "***************************"

#  year = getValidIntYear('CALENDAR YEAR (ie. 2013-2015,13)', 2013 , 2015)
  dat = datetime.datetime.now()
  year = int( dat.strftime('%Y') )
  print "Today: ", dat.strftime('%A, %m/%d/%Y')
 
  while check == 'y':
    print ""
    print "[ Group Header ]"

    dt = getdt(year)
    #print dt
    header = dt + ", Eastern Time"
    #print "Group header:  ", header

    print "[ Time Slots ]"
    openTimes = buildCalTimes()

    aList.append(header)
    
    for each in openTimes:
      aList.append(dt + ', ' + each)

    check = raw_input("Is there another date to add - Yes/No(Default) ?")
    if check == 'y':
      aList.append("")

  print ""
  print "[ Return List ]"  
  print ""
  
  for each in aList:
   print each

  clipOut = '\n'.join(aList)

  print ""

  # Clipboard stuff

  r = Tk() 
  r.withdraw()
  r.clipboard_clear()
  r.clipboard_append(clipOut) 
  
  print "List copied to clipboard.  Press enter to quit."
  check = raw_input("")
  r.destroy()
 
  exit(0)
开发者ID:whuey79,项目名称:calendar-answer-list-creator,代码行数:62,代码来源:dates3.py

示例8: get_clipboard

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import withdraw [as 别名]
def get_clipboard():
    """
    Get content of OS clipboard.
    """
    if 'xerox' in sys.modules.keys():
        print "Returning clipboard content using xerox..."
        return xerox.paste()
    elif 'pyperclip' in sys.modules.keys():
        print "Returning clipboard content using pyperclip..."
        return pyperclip.paste()
    elif 'gtk' in sys.modules.keys():
        print "Returning clipboard content using gtk..."
        clipboard = gtk.clipboard_get()
        return clipboard.wait_for_text()
    elif 'win32clipboard' in sys.modules.keys():
        wcb = win32clipboard
        wcb.OpenClipboard()
        try:
            data = wcb.GetClipboardData(wcb.CF_TEXT)
        except TypeError as e:
            print e
            print "No text in clipboard."
        wcb.CloseClipboard() # User cannot use clipboard until it is closed.
        return data
    else:
        print "locals.keys() is: ", sys.modules.keys().keys()
        print "falling back to Tk..."
        r = Tk()
        r.withdraw()
        result = r.selection_get(selection="CLIPBOARD")
        r.destroy()
        print "Returning clipboard content using Tkinter..."
        return result
开发者ID:thomsen3,项目名称:gelutils,代码行数:35,代码来源:clipboard.py

示例9: getPath

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import withdraw [as 别名]
def getPath():
    root = Tk()
    root.withdraw()
    InputPath = askdirectory(title="Choose Converting Picture Input Path")
    OutputPath = askdirectory(title="Choose Converting Picture Output Path")
    root.destroy()
    return InputPath, OutputPath
开发者ID:XinningShen,项目名称:Fisheye_Camera_Calibration,代码行数:9,代码来源:AdjustPicWithCalibratedCoefficient.py

示例10: main

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import withdraw [as 别名]
def main():
    parser = argparse.ArgumentParser()
    
    parser.add_argument("--l",     default=24,                 metavar='password_length',        help="password length, default is 24")
    parser.add_argument("--p",     action='store_true',                                          help="use punctuation")
    
    args = parser.parse_args()
#     print args.l
#     print args.p

    # Assemble base alphabet and generate password
    myrg = random.SystemRandom()
    alphabet = string.ascii_letters + string.digits
    if args.p:
        alphabet += string.punctuation
    pw = str().join(myrg.choice(alphabet) for _ in range(int(args.l)))
    
    print pw

    # put password in clipboard    
    r = Tk()
    r.withdraw()
    r.clipboard_clear()
    r.clipboard_append(pw)
    r.destroy()
开发者ID:VestedSkeptic,项目名称:password_gen,代码行数:27,代码来源:pgen.py

示例11: get_filedialog

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import withdraw [as 别名]
    def get_filedialog(what="file", **opts):
        """Wrapper around Tk file dialog to mange creating file dialogs in a cross platform way.

        Args:
            what (str): What sort of a dialog to create - options are 'file','directory','save','files'
            **opts (dict): Arguments to pass through to the underlying dialog function.

        Returns:
            A file name or directory or list of files.
        """
        from Tkinter import Tk
        import tkFileDialog as filedialog

        r = Tk()
        r.withdraw()
        funcs = {
            "file": filedialog.askopenfilename,
            "directory": filedialog.askdirectory,
            "files": filedialog.askopenfilenames,
            "save": filedialog.asksaveasfilename,
        }
        if what not in funcs:
            raise RuntimeError("Unable to recognise required file dialog type:{}".format(what))
        else:
            return funcs[what](**opts)
开发者ID:gb119,项目名称:Stoner-PythonCode,代码行数:27,代码来源:compat.py

示例12: on_botaoselecionar_activate

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import withdraw [as 别名]
 def on_botaoselecionar_activate(self, widget):
     """Funcao responsavel pelo RadioButton"""
     
     if self.count == 1:
         self.camera.release()
         self.c = True
         self.count = 0
     if self.RadioButt == 1:
         self.camera = cv2.VideoCapture(0)
         self.count = 1
         if not self.threadflag:
             app.thread_gtk()                   # gtk.main() only once (first time)
             app.threadflag=0                     # change flag
     else:
         self.c = False
         root = Tk()
         root.iconbitmap(default='favicon.ico')
         root.withdraw()
         self.file = askopenfilename(filetypes=[("JPEG", "*.jpg; *.jpe; *.jpeg; *.jfif"),
                              ("Bitmap Files","*read().bmp; *.dib"),
                              ("PNG", "*.png"),
                              ("TIFF", "*.tiff; *.tif")],initialdir = 'C:\\',multiple = False,title = "Abrindo imagens..")
         
         self.imagecam.set_from_file(self.file)    
         self.varsave = 1 
开发者ID:EliasThiago,项目名称:PyProjectLibras,代码行数:27,代码来源:Principal.py

示例13: PutAddressIntoClipboard

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import withdraw [as 别名]
def PutAddressIntoClipboard(address):
    r = Tk()
    r.withdraw()
    r.clipboard_clear()
    r.clipboard_append(address)
    r.destroy()
    return
开发者ID:Kirem,项目名称:PastebinUpload,代码行数:9,代码来源:pastebin_upload.py

示例14: loaddeck

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import withdraw [as 别名]
 def loaddeck(self):
     root = Tk()
     root.withdraw()
     filename = askopenfilename(filetypes=[("Zip Archives",".zip")],initialdir=self.deckdir,title="Load Slide Deck",parent=root)
     root.destroy()
     if filename != "":
         root = Tk()
         root.withdraw()
         password = askstring("Deck Password","Please enter the password for this zip file, or press cancel if you believe there isn't one:", parent=root)
         root.destroy()
         if filename:
             try:
                 unzipped = ZipFile(filename)
                 self.clearscribbles()
                 if password != None:
                     unzipped.extractall(path=self.scribblesdir,pwd=password)
                 else:
                     unzipped.extractall(path=self.scribblesdir,pwd="")
                 num_pages = 0
                 for x in os.listdir(self.scribblesdir):
                     if (os.path.splitext(x)[1] == ".png"):
                         num_pages += 1
                 self.send(["first",num_pages], "toSequencer")
                 self.send(chr(0) + "CLRTKR", "toTicker")
                 self.send("Deck loaded successfully","toTicker")
             except Exception:
                 e = sys.exc_info()[1]
                 self.send(chr(0) + "CLRTKR", "toTicker")
                 self.send("Failed to open the deck specified. You may have entered the password incorrectly","toTicker")
开发者ID:casibbald,项目名称:kamaelia,代码行数:31,代码来源:Decks.py

示例15: checkMgl

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import withdraw [as 别名]
def checkMgl(doSplash = True):
  from client.PrefsManager import GetPreference,SavePreference
  checkmgl = GetPreference("checkMgl")
  mglrev = GetPreference("mglRev")

  uptodate = mgl_uptodate()
  if not uptodate[0] and (checkmgl or uptodate[1] > mglrev):
    from Tkinter import Tk
    root = Tk()
    root.withdraw()
    from tkMessageBox import askyesno
    if doSplash:
        if(askyesno("Attention developers: Revised Mgltools found","Possibly due to a recent svn update, a revised version of Mgltools has been obtained. It is recommended to apply the update. Perform the update now?")):
            updateMgl(doSplash)
        else:
            from PromptString import showHyperMessage
            if(showHyperMessage("Attention developers: Revised Mgltools found", "Mgltools was not updated. You can manually apply the update yourself at a later time.\n "
                                +"Go to the link below to to read how to do this correctly. hl[0]",
                   option = "Check this box to disable this alert at startup (a subsequent revision will re-enable this alert).",
                   inserts=[("Click here","http://www.continuity.ucsd.edu/Continuity/Documentation/DeveloperDocs/UpgradingPython#mgltoolswin")])):
                SavePreference("checkMgl","0")
            else:
                SavePreference("checkMgl","1")
    
            SavePreference("mglRev",str(uptodate[1]))
    else:
        updateMgl(doSplash)
开发者ID:cmrglab,项目名称:cap_deident_gui,代码行数:29,代码来源:ContinuityClient.py


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