本文整理汇总了Python中tkinter.Toplevel.minsize方法的典型用法代码示例。如果您正苦于以下问题:Python Toplevel.minsize方法的具体用法?Python Toplevel.minsize怎么用?Python Toplevel.minsize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tkinter.Toplevel
的用法示例。
在下文中一共展示了Toplevel.minsize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: receivePrivateChat
# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import minsize [as 别名]
def receivePrivateChat(self, connectingUser):
global conversationBoxList
print("CHAT PRIVATA in arrivo con "+connectingUser)
newWindow = Toplevel(self.parent)
newWindow.title("Python Chat requested by "+connectingUser)
newWindow.minsize(400, 475)
newWindow.focus()
def disconnectPM():
del conversationBoxList[connectingUser]
newWindow.destroy()
newWindow.protocol('WM_DELETE_WINDOW', disconnectPM)
#label = Label(newWindow, text="PROVA PROVA")
#label.pack(side="top", fill="both", padx=10, pady=10)
frame = Frame(newWindow)
frame.pack(fill=BOTH, expand=1, side=LEFT)
box = ScrolledText(frame, wrap=WORD, relief = GROOVE, width=30, height=18, font=self.customFontMessage)
box.config(state=DISABLED)
box.pack(expand="yes", fill=BOTH, side=TOP)
textarea = Text(frame, width=30, height=5)
textarea.bind("<KeyRelease-Return>", lambda event : self.getprivatetext(event, textarea, connectingUser))
textarea.pack(expand="yes", fill=BOTH, side=TOP)
#aggiungo alla mappa globale il box di conversazione
conversationBoxList[connectingUser] = box
示例2: __init__
# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import minsize [as 别名]
class SpeciesListDialog:
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.rowconfigure(1, weight=1)
Label(self.gui, text="Registered Species:").grid(row=0, column=0, pady=5, padx=5, sticky="w")
self.listRegisteredSpecies = Listbox(self.gui, width=70)
self.buttonAdd = Button(self.gui, text=" + ")
self.buttonDel = Button(self.gui, text=" - ")
self.listRegisteredSpecies.grid(row=1, column=0, columnspan=3, sticky="nswe", pady=5, padx=5)
self.buttonAdd.grid(row=2, column=1, pady=5, padx=5)
self.buttonDel.grid(row=2, column=2, pady=5, 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.actionUpdate(None)
self.gui.bind("<<Update>>", self.actionUpdate)
self.gui.protocol("WM_DELETE_WINDOW", self.actionClose)
self.buttonDel.bind("<ButtonRelease>", self.actionDel)
self.buttonAdd.bind("<ButtonRelease>", self.actionAdd)
self.gui.mainloop()
def actionClose(self):
self.parent.guiRoot.event_generate("<<Update>>", when="tail")
self.gui.destroy()
def actionUpdate(self, event):
self.listRegisteredSpecies.delete(0, "end")
for (taxid, name) in self.parent.optimizer.speciesList:
self.listRegisteredSpecies.insert("end", taxid + ": " + name)
def actionDel(self, event):
try:
selection = self.listRegisteredSpecies.selection_get()
selectionSplit = selection.split(": ")
self.parent.optimizer.speciesList.remove((selectionSplit[0], selectionSplit[1]))
self.gui.event_generate("<<Update>>")
except tkinter.TclError:
# no selection
pass
def actionAdd(self, Event):
SpeciesSearchDialog(self.parent, self)
示例3: TkTimerCore
# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import minsize [as 别名]
class TkTimerCore(TimerCore):
def __init__(self, *args, title, font_size, **kwargs):
def close_handler(event):
self.close()
def clicked_handler(event):
self.interact()
self.master = Tk()
self.master.wm_title(title)
self.master.bind('<Destroy>', close_handler)
self.label = Label(self.master, font='Sans {}'.format(int(font_size)))
self.label.pack(expand=True)
self.control = Toplevel()
self.control.wm_title(title + ' (control)')
self.control.minsize(150, 150)
self.control.bind('<Destroy>', close_handler)
self.button = Button(self.control, text='Start/Pause')
self.button.bind('<ButtonRelease>', clicked_handler)
self.button.pack(expand=True)
self.timeout_running = False
super().__init__(*args, **kwargs)
def start_timeout(self):
assert self.timeout_running is False
def timeout_call():
if self.timeout_running:
self.update()
self.master.after(25, timeout_call)
self.timeout_running = True
timeout_call()
def stop_timeout(self):
assert self.timeout_running is True
self.timeout_running = False
def mainloop(self):
return self.master.mainloop()
def shutdown(self):
self.master.quit()
def set_label_text(self, text, finished=False):
self.label.config(text=text)
if finished:
self.label.config(fg='red')
示例4: newWindow
# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import minsize [as 别名]
def newWindow(self, parent):
random.seed()
colorInt = random.randint(0,2)
if colorInt == 0:
bgColor = "red"
elif colorInt == 1:
bgColor = "white"
else:
bgColor = "blue"
top = Toplevel()
winWidth, winHeight = 200, 200
top.minsize(width=winWidth, height=winHeight)
top.title("New!")
top.configure(background=bgColor)
label = Label(top, text=("This window has a " + str(bgColor) +
" background!"))
label.pack(side="top")
but = Button(top, text="New Window",
command= lambda: self.newWindow(parent))
but.pack(expand=True)
but2 = Button(top, text="Close All", command=parent.destroy)
but2.pack(side="bottom")
but3 = Button(top, text="Close Current", command=top.destroy)
but3.pack(side="bottom")
示例5: Overlay
# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import minsize [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)
#.........这里部分代码省略.........