本文整理汇总了Python中tkinter.Tk.wm_withdraw方法的典型用法代码示例。如果您正苦于以下问题:Python Tk.wm_withdraw方法的具体用法?Python Tk.wm_withdraw怎么用?Python Tk.wm_withdraw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tkinter.Tk
的用法示例。
在下文中一共展示了Tk.wm_withdraw方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Tk
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import wm_withdraw [as 别名]
@license This software is free - http://www.gnu.org/licenses/gpl.html
@link https://www.brython.info/static_doc/en/intro.html
@link https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API
'''
from tkinter import Tk, messagebox, simpledialog
import subprocess, sys
try:
import pygame
except:
subprocess.call([sys.executable, "-m", "pip", "install", "pygame"])
import pygame
_tkmain = Tk()
_tkmain.wm_withdraw() #to hide the main window
_ws, _hs = _tkmain.winfo_screenwidth(), _tkmain.winfo_screenheight()
_tkmain.geometry("100x100+%d+%d" % (_ws//2, _hs//2))
_canvas = None
_update, _keydown, _keyup = None, None, None
_color = (127, 127, 127)
_mouse_pos = (0, 0)
_mouse_codes = ["LeftButton", "MiddleButton", "RightButton"]
def init_canvas(size: (int, int)):
'''Set size of first CANVAS and return it'''
global _canvas
pygame.init()
_canvas = pygame.display.set_mode(size)
clear_canvas()
示例2: getattr
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import wm_withdraw [as 别名]
from datetime import datetime, timedelta
from win32com.client import Dispatch
from tkinter import Tk
import tkinter.messagebox as mbox
curdir = None
if getattr(sys, 'frozen', False):
# frozen
curdir = path.dirname(sys.executable)
else:
# unfrozen
curdir = path.dirname(path.abspath(__file__))
mylabel = path.join(curdir,'my.label')
window = Tk()
window.wm_withdraw()
if not path.isfile(mylabel):
mbox.showinfo('PyDymoLabel','Template file my.label does not exist')
sys.exit(1)
try:
now = datetime.now()
next = now + timedelta(30)
labelCom = Dispatch('Dymo.DymoAddIn')
labelText = Dispatch('Dymo.DymoLabels')
isOpen = labelCom.Open(mylabel)
selectPrinter = 'DYMO LabelWriter 450'
labelCom.SelectPrinter(selectPrinter)