本文整理汇总了Python中tkinter.Toplevel.resizable方法的典型用法代码示例。如果您正苦于以下问题:Python Toplevel.resizable方法的具体用法?Python Toplevel.resizable怎么用?Python Toplevel.resizable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tkinter.Toplevel
的用法示例。
在下文中一共展示了Toplevel.resizable方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ListDialog
# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import resizable [as 别名]
class ListDialog(object):
def __init__ (self, master, items, message, accept_func):
self.accept_func = accept_func
self.top = Toplevel(master)
self.top.transient(master)
self.top.rowconfigure(0, weight=1)
self.top.rowconfigure(1, weight=3)
self.top.rowconfigure(2, weight=0)
self.top.columnconfigure(0, weight=1)
self.top.columnconfigure(1, weight=1)
self.top.resizable(width=True, height=True)
self.frame = Frame(self.top)
self.frame.rowconfigure(0, weight=1)
self.frame.rowconfigure(1, weight=0)
self.frame.columnconfigure(0, weight=1)
self.frame.columnconfigure(1, weight=0)
self.frame.grid(row=0, column=0, sticky=(N, S, W, E), columnspan=2)
self.canvas = Canvas(self.frame)
self.canvas.create_text(0, 0, text=message, anchor=NW)
self.canvas.grid(row=0, column=0, sticky=(N, W, S, E))
self.vscroll = Scrollbar(self.frame, command=self.canvas.yview)
self.vscroll.grid(row=0, column=1, sticky=(N, S))
self.canvas['yscrollcommand'] = self.vscroll.set
self.hscroll = Scrollbar(self.frame, command=self.canvas.xview, orient=HORIZONTAL)
self.hscroll.grid(row=1, column=0, sticky=(W, E), columnspan=2)
self.canvas['xscrollcommand'] = self.hscroll.set
self.canvas['scrollregion'] = self.canvas.bbox('all')
self.canvas.bind('<Button-4>', self.scroll)
self.canvas.bind('<Button-5>', self.scroll)
self.canvas.bind('<MouseWheel>', self.scroll)
self.view = NameView(self.top, sorted(items))
self.view.widget.grid(row=1, column=0, columnspan=2, sticky=(N, W, E, S))
self.delbutton = Button(self.top, text='Ok', command=self.accept )
self.cancelbutton = Button(self.top, text='Cancel', command=self.cancel)
self.delbutton.grid(row=2, column=0)
self.cancelbutton.grid(row=2, column=1)
self.view.widget.focus_set()
def accept(self):
self.accept_func(self.view.selection())
self.top.destroy()
def cancel(self):
self.result = None
self.top.destroy()
def scroll(self, event):
if event.num == 4 or event.delta > 0:
self.canvas.yview(SCROLL, -1, UNITS)
elif event.num == 5 or event.delta < 0:
self.canvas.yview(SCROLL, 1, UNITS)
示例2: __about
# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import resizable [as 别名]
def __about(self):
'''
None -> None
Associated with the Help Menu.
Creates a new window with the "About" information
'''
appversion = "1.6"
appname = "EXCEL to KML Transformer"
copyright = 14 * ' ' + '(c) 2013' + 12 * ' ' + \
'SDATO - DP - UAF - GNR\n' + 34 * ' '\
+ "All Rights Reserved"
licence = 18 * ' ' + 'http://opensource.org/licenses/GPL-3.0\n'
contactname = "Nuno Venâncio"
contactphone = "(00351) 969 564 906"
contactemail = "[email protected]"
message = "Version: " + appversion + 5 * "\n"
message0 = "Copyright: " + copyright + "\n" + "Licença: " + licence
message1 = contactname + '\n' + contactphone + '\n' + contactemail
icons = os.getcwd() + os.sep + "icons" + os.sep # path to icons
icon = icons + "compass.ico"
tl = Toplevel(self.master)
tl.configure(borderwidth=5)
tl.title("Sobre...")
tl.iconbitmap(icon)
tl.resizable(width=FALSE, height=FALSE)
f1 = Frame(tl, borderwidth=2, relief=SUNKEN, bg="gray25")
f1.pack(side=TOP, expand=TRUE, fill=BOTH)
l0 = Label(f1, text=appname, fg="white", bg="gray25",
font=('courier', 16, 'bold'))
l0.grid(row=0, column=0, sticky=W, padx=10, pady=5)
l1 = Label(f1, text=message, justify=CENTER,
fg="white", bg="gray25")
l1.grid(row=2, column=0, sticky=E, columnspan=3, padx=10, pady=0)
l2 = Label(f1, text=message0,
justify=LEFT, fg="white", bg="gray25")
l2.grid(row=6, column=0, columnspan=2, sticky=W, padx=10, pady=0)
l3 = Label(f1, text=message1,
justify=CENTER, fg="white", bg="gray25")
l3.grid(row=7, column=0, columnspan=2, padx=10, pady=0)
button = Button(tl, text="Ok", command=tl.destroy, width=10)
button.pack(pady=5)
示例3: show_about
# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import resizable [as 别名]
def show_about(self):
about = Toplevel(self.master)
about.title('About {}'.format(self.version[:-5]))
about.focus()
about.resizable(0, 0)
logo_lbl = Label(about, image=self.logo)
logo_lbl.image = self.logo
logo_lbl.grid(row=0, column=0, padx='7 11', pady=13, sticky='n')
about_frame = Frame(about, padding='0 10 10 10')
about_frame.grid(row=0, column=1)
Label(about_frame, text=self.version).grid(sticky='w')
Label(about_frame, text='Developer: Joel W. Dafoe').grid(pady='6', sticky='w')
link = Link(about_frame, text='http://cyberdatx.com', foreground='blue', cursor='hand2')
link.grid(sticky='w')
link.bind('<Button-1>', lambda e: webbrowser.open('http://cyberdatx.com'))
Label(about_frame, text=self.description, wraplength=292).grid(columnspan=2, pady=6, sticky='w')
cls_btn = Button(about_frame, text='OK', command=about.destroy)
cls_btn.grid(column=1, sticky='e')
cls_btn.focus()
about.bind('<Return>', lambda e: cls_btn.invoke())
示例4: _license
# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import resizable [as 别名]
def _license(self):
""" affiche la licence dans une nouvelle fenêtre """
def close():
""" ferme la fenêtre """
self.focus_set()
fen.destroy()
fen = Toplevel(self)
fen.title(_("License"))
fen.transient(self)
fen.protocol("WM_DELETE_WINDOW", close)
fen.resizable(0, 0)
fen.grab_set()
# set_icon(fen)
texte = Text(fen, width=50, height=18)
texte.pack()
texte.insert("end",
_("Sudoku-Tk is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\n\n"))
texte.insert("end",
_("Sudoku-Tk is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n"))
texte.insert("end",
_("You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/."))
i = int(texte.index("5.end").split(".")[1])
texte.tag_add("link", "5.%i" % (i - 29), "5.%i" % (i - 1))
texte.tag_configure("link", foreground="#0000ff", underline=1)
texte.tag_bind("link", "<Button - 1>",
lambda event: webOpen("http://www.gnu.org/licenses/"))
texte.tag_bind("link", "<Enter>",
lambda event: texte.config(cursor="hand1"))
texte.tag_bind("link",
"<Leave>", lambda event: texte.config(cursor=""))
texte.configure(state="disabled", wrap="word")
b_close = Button(fen, text=_("Close"), command=close)
b_close.pack(side="bottom")
b_close.focus_set()
fen.wait_window(fen)
示例5: nameHandler
# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import resizable [as 别名]
def nameHandler(name, message):
'''Takes a string name and character, provides an interface for correcting
the illegal name, returns a new legal string name.'''
#todo: create a proper validate method
def destroy(*args):
root.destroy()
root = Toplevel()
root.title('Bad Name')
root.resizable(False, False)
root.after(100, root.focus_force) #todo: temp?
mainFrame = ttk.Frame(root, padding=MAIN_PAD)
mainFrame.grid(column=0, row=0, sticky='nwes')
newname = StringVar(value=name)
nameEntry = ttk.Entry(mainFrame, textvariable=newname)
nameEntry.grid(row=1, sticky='we')
ttk.Label(mainFrame, text=message).grid(row=0)
for child in mainFrame.winfo_children():
child.grid(padx=5, pady=5)
nameEntry.after(100, nameEntry.focus) #todo: temp?
root.bind('<Return>', destroy)
root.wait_window()
#todo: disable the ability to close the window instead? add abort option?
if len(newname.get()) < 1:
return nameHandler(name, message)
else:
return newname.get()
示例6: show_stat
# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import resizable [as 别名]
def show_stat(self):
""" show best times """
def reset():
""" reset best times """
for level in ["easy", "medium", "difficult"]:
CONFIG.set("Statistics", level, "")
top.destroy()
if self.chrono_on:
self.play_pause()
top = Toplevel(self)
top.transient(self)
top.columnconfigure(1, weight=1)
top.resizable(0, 0)
top.title(_("Statistics"))
top.grab_set()
Label(top, text=_("Best times"), font="Sans 12 bold").grid(row=0, columnspan=2,
padx=30, pady=10)
for i, level in enumerate(["easy", "medium", "difficult"]):
Label(top, text=_(level.capitalize()),
font="Sans 10 bold").grid(row=i + 1, column=0, padx=(20, 4),
pady=4, sticky="e")
tps = CONFIG.get("Statistics", level)
if tps:
tps = int(tps)
m = tps // 60
s = tps % 60
Label(top, text=" %i min %i s" % (m, s),
font="Sans 10").grid(row=i + 1, column=1,
sticky="w", pady=4,
padx=(4, 20))
Button(top, text=_("Close"), command=top.destroy).grid(row=4, column=0, padx=(10, 4), pady=10)
Button(top, text=_("Clear"), command=reset).grid(row=4, column=1, padx=(4, 10), pady=10)
示例7: Overlay
# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import resizable [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)
#.........这里部分代码省略.........
示例8: sideWindow
# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import resizable [as 别名]
class sideWindow(AppShell):
#################################################################
# sideWindow(AppShell)
# This class will open a side window wich contains a scene graph and
# a world setting page.
#################################################################
appversion = '1.0'
appname = 'Navigation Window'
frameWidth = 325
frameHeight = 580
frameIniPosX = 0
frameIniPosY = 110
padx = 0
pady = 0
lightEnable = 0
ParticleEnable = 0
basedriveEnable = 0
collision = 0
backface = 0
texture = 1
wireframe = 0
enableBaseUseDrive = 0
def __init__(self, worldColor,lightEnable,ParticleEnable, basedriveEnable,collision,
backface, texture, wireframe, grid, widgetVis, enableAutoCamera, parent = None, nodePath = render, **kw):
self.worldColor = worldColor
self.lightEnable = lightEnable
self.ParticleEnable = ParticleEnable
self.basedriveEnable = basedriveEnable
self.collision = collision
self.backface = backface
self.texture = texture
self.wireframe = wireframe
self.grid = grid
self.enableAutoCamera = enableAutoCamera
self.widgetVis = widgetVis
# Define the megawidget options.
optiondefs = (
('title', self.appname, None),
)
self.defineoptions(kw, optiondefs)
if parent == None:
self.parent = Toplevel()
else:
self.parent = parent
AppShell.__init__(self, self.parent)
self.parent.geometry('%dx%d+%d+%d' % (self.frameWidth, self.frameHeight,self.frameIniPosX,self.frameIniPosY))
self.parent.resizable(False,False) ## Disable the ability to resize for this Window.
def appInit(self):
print('----SideWindow is Initialized!!')
def createInterface(self):
# The interior of the toplevel panel
interior = self.interior()
mainFrame = Frame(interior)
## Creat NoteBook
self.notebookFrame = Pmw.NoteBook(mainFrame)
self.notebookFrame.pack(fill=tkinter.BOTH,expand=1)
sgePage = self.notebookFrame.add('Tree Graph')
envPage = self.notebookFrame.add('World Setting')
self.notebookFrame['raisecommand'] = self.updateInfo
## Tree Grapgh Page
self.SGE = seSceneGraphExplorer.seSceneGraphExplorer(
sgePage, nodePath = render,
scrolledCanvas_hull_width = 270,
scrolledCanvas_hull_height = 570)
self.SGE.pack(fill = tkinter.BOTH, expand = 0)
## World Setting Page
envPage = Frame(envPage)
pageFrame = Frame(envPage)
self.LightingVar = IntVar()
self.LightingVar.set(self.lightEnable)
self.LightingButton = Checkbutton(
pageFrame,
text = 'Enable Lighting',
variable = self.LightingVar,
command = self.toggleLights)
self.LightingButton.pack(side=tkinter.LEFT, expand=False)
pageFrame.pack(side=tkinter.TOP, fill=tkinter.X, expand=True)
pageFrame = Frame(envPage)
self.CollisionVar = IntVar()
self.CollisionVar.set(self.collision)
self.CollisionButton = Checkbutton(
pageFrame,
text = 'Show Collision Object',
variable = self.CollisionVar,
command = self.showCollision)
self.CollisionButton.pack(side=tkinter.LEFT, expand=False)
pageFrame.pack(side=tkinter.TOP, fill=tkinter.X, expand=True)
#.........这里部分代码省略.........