本文整理汇总了Python中Tkinter.YES属性的典型用法代码示例。如果您正苦于以下问题:Python Tkinter.YES属性的具体用法?Python Tkinter.YES怎么用?Python Tkinter.YES使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类Tkinter
的用法示例。
在下文中一共展示了Tkinter.YES属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: mainloop
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import YES [as 别名]
def mainloop(self):
try:
import Tkinter as tk
except ImportError:
import tkinter as tk
from PIL import Image, ImageTk
from ttk import Frame, Button, Style
import time
import socket
self.root = tk.Toplevel() #Tk()
self.root.title('Display')
self.image = Image.fromarray(np.zeros((200,200))).convert('RGB')
self.image1 = ImageTk.PhotoImage(self.image)
self.panel1 = tk.Label(self.root, image=self.image1)
self.display = self.image1
self.frame1 = Frame(self.root, height=50, width=50)
self.panel1.pack(side=tk.TOP, fill=tk.BOTH, expand=tk.YES)
self.root.after(100, self.advance_image)
self.root.after(100, self.update_image)
self.root.protocol("WM_DELETE_WINDOW", self.on_closing)
#global _started_tkinter_main_loop
#if not _started_tkinter_main_loop:
# _started_tkinter_main_loop = True
# print("Starting Tk main thread...")
示例2: __init__
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import YES [as 别名]
def __init__(self, root, rect, frame_color, screen_cap, queue):
""" Accepts rect as (x,y,w,h) """
self.root = root
self.root.tk.call('tk', 'scaling', 0.5)
tk.Toplevel.__init__(self, self.root, bg="red", bd=0)
self.queue = queue
self.check_close_after = None
## Set toplevel geometry, remove borders, and push to the front
self.geometry("{2}x{3}+{0}+{1}".format(*rect))
self.overrideredirect(1)
self.attributes("-topmost", True)
## Create canvas and fill it with the provided image. Then draw rectangle outline
self.canvas = tk.Canvas(
self,
width=rect[2],
height=rect[3],
bd=0,
bg="blue",
highlightthickness=0)
self.tk_image = ImageTk.PhotoImage(Image.fromarray(screen_cap))
self.canvas.create_image(0, 0, image=self.tk_image, anchor=tk.NW)
self.canvas.create_rectangle(
2,
2,
rect[2]-2,
rect[3]-2,
outline=frame_color,
width=4)
self.canvas.pack(fill=tk.BOTH, expand=tk.YES)
## Lift to front if necessary and refresh.
self.lift()
self.update()
示例3: __init__
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import YES [as 别名]
def __init__(self, root, rect, frame_color, screen_cap):
""" Accepts rect as (x,y,w,h) """
self.root = root
tk.Toplevel.__init__(self, self.root, bg="red", bd=0)
## Set toplevel geometry, remove borders, and push to the front
self.geometry("{2}x{3}+{0}+{1}".format(*rect))
self.overrideredirect(1)
self.attributes("-topmost", True)
## Create canvas and fill it with the provided image. Then draw rectangle outline
self.canvas = tk.Canvas(
self,
width=rect[2],
height=rect[3],
bd=0,
bg="blue",
highlightthickness=0)
self.tk_image = ImageTk.PhotoImage(Image.fromarray(screen_cap[..., [2, 1, 0]]))
self.canvas.create_image(0, 0, image=self.tk_image, anchor=tk.NW)
self.canvas.create_rectangle(
2,
2,
rect[2]-2,
rect[3]-2,
outline=frame_color,
width=4)
self.canvas.pack(fill=tk.BOTH, expand=tk.YES)
## Lift to front if necessary and refresh.
self.lift()
self.update()
示例4: __init__
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import YES [as 别名]
def __init__(self, aRoot, aLifeCount = 100, aWidth = 560, aHeight = 330):
self.root = aRoot
self.lifeCount = aLifeCount
self.width = aWidth
self.height = aHeight
self.canvas = Tkinter.Canvas(
self.root,
width = self.width,
height = self.height,
)
self.canvas.pack(expand = Tkinter.YES, fill = Tkinter.BOTH)
self.bindEvents()
self.initCitys()
self.new()
self.title("TSP")
示例5: __put_buttons_in_buttonframe
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import YES [as 别名]
def __put_buttons_in_buttonframe(choices):
"""Put the buttons in the buttons frame"""
global __widgetTexts, __firstWidget, buttonsFrame
__firstWidget = None
__widgetTexts = {}
i = 0
for buttonText in choices:
tempButton = tk.Button(buttonsFrame, takefocus=1, text=buttonText)
_bindArrows(tempButton)
tempButton.pack(
expand=tk.YES, side=tk.LEFT, padx="1m", pady="1m", ipadx="2m", ipady="1m"
)
# remember the text associated with this widget
__widgetTexts[tempButton] = buttonText
# remember the first widget, so we can put the focus there
if i == 0:
__firstWidget = tempButton
i = 1
# for the commandButton, bind activation events to the activation event handler
commandButton = tempButton
handler = __buttonEvent
for selectionEvent in STANDARD_SELECTION_EVENTS:
commandButton.bind("<%s>" % selectionEvent, handler)
if CANCEL_TEXT in choices:
commandButton.bind("<Escape>", __cancelButtonEvent)
示例6: __init__
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import YES [as 别名]
def __init__(self, master=None, cnf={}, **kw):
super(Application, self).__init__(master, cnf, **kw)
self.title = 'SubFinder'
self.videofile = ''
self._output = None
# self.master.geometry('300x100')
self.master.title(self.title)
self.pack(fill=tk.BOTH, expand=tk.YES, padx=10, pady=10)
self._create_widgets()
示例7: doConvertDirectory
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import YES [as 别名]
def doConvertDirectory(self):
"""Method to convert all NSF files in a directory"""
tl = self.winfo_toplevel()
self.log(ErrorLevel.NORMAL, _("Starting Convert : %s\n") % datetime.datetime.now())
if self.Format.get() == Format.MBOX and self.MBOXType.get() == SubdirectoryMBOX.NO:
self.log(ErrorLevel.WARN, _("The MBOX file will not have the directory hierarchies present in NSF file\n"))
if self.Format.get() == Format.PST:
# Check if our Outlook is 64bit, and adapt the importation
# strategy accoridngly. The MAPI interface must have the
# same bitness as the version of Outlook, so the EML2PST option
# forces a call an external helper program of the right bitness
# to do the importation. See
# https://msdn.microsoft.com/en-us/library/office/dd941355.aspx?f=255&MSPPError=-2147217396
if platform.architecture()[0] == "32bit":
# NSF2X is running as a 32bit application
if platform.architecture(executable=OutlookPath())[0] != "32bit":
# Need to use the 64bit helper function
self.EML2PST = "helper64/eml2pst.exe"
self.log(ErrorLevel.NORMAL, _("Detected 32bit NFS2X and 64bit Outlook"))
elif self.Helper.get() == Helper.YES:
self.EML2PST = "helper32/eml2pst.exe"
self.log(ErrorLevel.NORMAL, _("Forcing use of external helper function"))
else:
# NSF2X is running as a 64bit application
if platform.architecture(executable=OutlookPath())[0] == '32bit':
# Need to use the 32bit helper function
self.EML2PST = 'helper32/eml2pst.exe'
self.log(ErrorLevel.NORMAL, _("Detected 64bit NFS2X and 32bit Outlook"))
elif self.Helper.get() == Helper.YES:
self.EML2PST = "helper64/eml2pst.exe"
self.log(ErrorLevel.NORMAL, _("Forcing use of external helper function"))
if self.EML2PST:
self.log(ErrorLevel.NORMAL, _("Using external helper function '%s' for importation of the EML files") % self.EML2PST)
for src in os.listdir(self.nsfPath):
if not self.running:
break
abssrc = os.path.join(self.nsfPath, src)
if os.path.isfile(abssrc) and src.lower().endswith('.nsf'):
dest = src[:-4]
try:
self.realConvert(src, dest)
except (pywintypes.com_error, OSError) as ex: # pylint: disable=E1101
self.log(ErrorLevel.ERROR, _("Error converting database %s") % src)
self.log(ErrorLevel.ERROR, _("Exception %s :") % ex)
self.log(ErrorLevel.ERROR, "%s" % traceback.format_exc())
self.log(ErrorLevel.NORMAL, _("End of convert : %s\n") % datetime.datetime.now())
tl.title(_("Lotus Notes Converter"))
self.update()
self.running = False
self.configDirectoryEntry(False)
示例8: _buttonbox
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import YES [as 别名]
def _buttonbox(msg, title, choices, root=None, timeout=None):
"""
Display a msg, a title, and a set of buttons.
The buttons are defined by the members of the choices list.
Return the text of the button that the user selected.
@arg msg: the msg to be displayed.
@arg title: the window title
@arg choices: a list or tuple of the choices to be displayed
"""
global boxRoot, __replyButtonText, __widgetTexts, buttonsFrame
# Initialize __replyButtonText to the first choice.
# This is what will be used if the window is closed by the close button.
__replyButtonText = choices[0]
if root:
root.withdraw()
boxRoot = tk.Toplevel(master=root)
boxRoot.withdraw()
else:
boxRoot = tk.Tk()
boxRoot.withdraw()
boxRoot.title(title)
boxRoot.iconname("Dialog")
boxRoot.geometry(rootWindowPosition)
boxRoot.minsize(400, 100)
# ------------- define the messageFrame ---------------------------------
messageFrame = tk.Frame(master=boxRoot)
messageFrame.pack(side=tk.TOP, fill=tk.BOTH)
# ------------- define the buttonsFrame ---------------------------------
buttonsFrame = tk.Frame(master=boxRoot)
buttonsFrame.pack(side=tk.TOP, fill=tk.BOTH)
# -------------------- place the widgets in the frames -----------------------
messageWidget = tk.Message(messageFrame, text=msg, width=400)
messageWidget.configure(font=(PROPORTIONAL_FONT_FAMILY, PROPORTIONAL_FONT_SIZE))
messageWidget.pack(side=tk.TOP, expand=tk.YES, fill=tk.X, padx="3m", pady="3m")
__put_buttons_in_buttonframe(choices)
# -------------- the action begins -----------
# put the focus on the first button
__firstWidget.focus_force()
boxRoot.deiconify()
if timeout is not None:
boxRoot.after(timeout, timeoutBoxRoot)
boxRoot.mainloop()
try:
boxRoot.destroy()
except tk.TclError:
if __replyButtonText != TIMEOUT_RETURN_VALUE:
__replyButtonText = None
if root:
root.deiconify()
return __replyButtonText