本文整理汇总了Python中tkinter.Toplevel.maxsize方法的典型用法代码示例。如果您正苦于以下问题:Python Toplevel.maxsize方法的具体用法?Python Toplevel.maxsize怎么用?Python Toplevel.maxsize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tkinter.Toplevel
的用法示例。
在下文中一共展示了Toplevel.maxsize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import maxsize [as 别名]
class AddRestrictionDialog:
def __init__(self, parent):
self.parent = parent
self.gui = Toplevel(parent.guiRoot)
self.gui.grab_set()
self.gui.focus()
self.gui.columnconfigure(0, weight=1)
self.gui.columnconfigure(1, weight=1)
Label(self.gui, text="Enzyme:").grid(row=0, column=0, sticky="e", padx=5)
self.entryEnzyme = Entry(self.gui)
self.entryEnzyme.grid(row=0, column=1, sticky="w", padx=5, pady=10)
self.frameButtonGroup = Frame(self.gui)
self.frameButtonGroup.grid(row=1, column=0, columnspan=2, pady=10)
self.buttonOK = Button(self.frameButtonGroup, text=" OK ")
self.buttonCancel = Button(self.frameButtonGroup, text=" Cancel ")
self.buttonOK.grid(row=0, column=1, sticky="w", padx=5)
self.buttonCancel.grid(row=0, column=0, sticky="e", padx=5)
# Set (minimum + max) Window size
self.gui.update()
self.gui.minsize(self.gui.winfo_width(), self.gui.winfo_height())
self.gui.maxsize(self.gui.winfo_width(), self.gui.winfo_height())
self.entryEnzyme.focus()
self.buttonOK.bind("<ButtonRelease>", self.actionOK)
self.buttonCancel.bind("<ButtonRelease>", self.actionCancel)
self.entryEnzyme.bind("<Return>", self.actionOK)
self.gui.mainloop()
# self.gui.grab_release()
# self.gui.destroy()
def actionOK(self, event):
enzymeString = self.entryEnzyme.get()
if enzymeString in rest_dict.keys():
if enzymeString in self.parent.optimizer.restrictionEnzymeList:
showinfo("", (enzymeString + " was already added to the list"))
return
self.parent.optimizer.restrictionEnzymeList.append(enzymeString)
self.parent.guiRoot.event_generate("<<Update>>", when="tail")
self.gui.destroy()
else:
showinfo("", (enzymeString + " is not a valid restriction enzyme"))
def actionCancel(self, event):
self.gui.destroy()
示例2: Overlay
# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import maxsize [as 别名]
class Overlay(threading.Thread):
def __init__(self,
width, height,
xpos, ypos,
bgcolor, fgcolor,
fontsize, opacity,
messages, close):
threading.Thread.__init__(self, daemon=True)
self.width = width
self.height = height
self.xpos = xpos
self.ypos = ypos
self.bgcolor = bgcolor
self.fgcolor = fgcolor
self.fontsize = fontsize
self.opacity = opacity
self.messages = messages
self.close = close
username_colors = [
'#0000ff',
'#ff7f50',
'#1e90ff',
'#00ff7f',
'#9acd32',
'#00ff00',
'#ff4500',
'#ff0000',
'#daa520',
'#ff69b4',
'#5f9ea0',
'#2e8b57',
'#d2691e',
'#8a2be2',
'#b22222',
]
self.color_for = defaultdict(lambda: random.choice(username_colors))
self.start()
self.images = []
def die(self):
self.images = None
self.close.put('killme')
self.root.quit()
def run(self):
self.root = MyRoot()
self.root.lower()
self.root.iconify()
self.root.title('poetato overlay')
self.root.protocol('WM_DELETE_WINDOW', self.die)
self.app = Toplevel(self.root)
self.app.geometry("%dx%d+%d+%d" % (self.width, self.height,
self.xpos, self.ypos))
self.app.resizable(width=False, height=False)
self.app.overrideredirect(1)
self.app.minsize(width=self.width, height=self.height)
self.app.maxsize(width=self.width, height=self.height)
self.app.attributes(
'-alpha', self.opacity,
'-topmost', True,
'-disabled', True,
)
self.text = Text(self.app,
bg=self.bgcolor, fg=self.fgcolor,
wrap='word', state='disabled')
self.text.configure(font=('Helvetica', self.fontsize, 'bold'))
self.text.pack()
self.app.lift()
# tell Windows(tm) to allow clicks to pass through our overlay.
hWindow = pywintypes.HANDLE(int(self.root.frame(), 16))
exStyle = (win32con.WS_EX_LAYERED |
win32con.WS_EX_TRANSPARENT |
win32con.WS_EX_NOACTIVATE)
win32api.SetWindowLong(hWindow, win32con.GWL_EXSTYLE, exStyle)
self.app.after(100, self.update)
self.app.mainloop()
def update(self):
if self.messages.empty():
self.app.after(100, self.update)
return
msg = self.messages.get_nowait()
self.text['state'] = 'normal'
if self.text.index('end-1c') != '1.0':
self.text.insert('end', '\n')
self.text.insert('end', "{0}: ".format(msg.display_name))
emote_insertions = {}
for eid, pos in msg.emotes.items():
for p in pos:
emote_insertions[p[0]] = (msg.localemotes[eid], p[1]+1)
#.........这里部分代码省略.........