本文整理汇总了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()
示例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
示例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()
示例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
示例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
示例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()
示例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)
示例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
示例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
示例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()
示例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)
示例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
示例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
示例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")
示例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)