本文整理汇总了Python中Tkinter.Tk.option_add方法的典型用法代码示例。如果您正苦于以下问题:Python Tk.option_add方法的具体用法?Python Tk.option_add怎么用?Python Tk.option_add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tkinter.Tk
的用法示例。
在下文中一共展示了Tk.option_add方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: show_msgbox
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import option_add [as 别名]
def show_msgbox(title, msg, msgtype='info'):
localRoot = Tk()
localRoot.withdraw()
localRoot.option_add('*font', 'Helvetica -12')
localRoot.quit()
if msgtype == 'info':
return tkinter_msgbox.showinfo(title, msg)
elif msgtype == 'error':
return tkinter_msgbox.showerror(title, msg)
示例2: main
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import option_add [as 别名]
def main():
window = Tk()
window.option_add('*Dialog.msg.wrapLength', '10i')
window.withdraw()
ret = askyesno('Flash Local', 'It will shallow flash gaia/gecko from local file system.', icon='info')
if ret:
pass
else:
quit()
is_flash_gaia = False
GAIA_FILEOPENOPTIONS = {'title': 'Select the Gaia package (gaia.zip)', 'defaultextension': '.zip', 'filetypes': [('Zip file', '*.zip'), ('All files', '*.*')]}
gaia_filename = askopenfilename(**GAIA_FILEOPENOPTIONS)
if gaia_filename:
is_flash_gaia = True
is_flash_gecko = False
GECKO_FILEOPENOPTIONS = {'title': 'Select the Gecko package (b2g-xxx.android-arm.tar.gz)', 'defaultextension': '.tar.gz', 'filetypes': [('Gzip file', '*.tar.gz'), ('All files', '*.*')]}
gecko_filename = askopenfilename(**GECKO_FILEOPENOPTIONS)
if gecko_filename:
is_flash_gecko = True
if not is_flash_gaia and not is_flash_gecko:
quit()
comfirm_message = 'Are You Sure?\n'
if is_flash_gaia:
comfirm_message = comfirm_message + '\nGaia:\n%s\n' % gaia_filename
if is_flash_gecko:
comfirm_message = comfirm_message + '\nGecko:\n%s\n' % gecko_filename
ret = askyesno('Comfirm', comfirm_message, icon='warning')
if ret:
do_flash(is_flash_gaia, gaia_filename, is_flash_gecko, gecko_filename)
comfirm_message = "Flash next device. " + comfirm_message
while True:
ret = askyesno('Comfirm', comfirm_message, icon='warning')
if ret:
do_flash(is_flash_gaia, gaia_filename, is_flash_gecko, gecko_filename)
else:
quit()
else:
quit()
示例3: Config
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import option_add [as 别名]
config = Config()
fields = config.getCurrentBank( ibanType )
bankStatement = BankStatement()
bankStatement.account = ibans[0]
csvReader = CsvReader(fields)
csvReader.readFile( filename, bankStatement )
ofx = Ofx()
ofx.createXmlFile( filename, bankStatement )
checkButton.configure(state=constants.DISABLED)
def onExit(self):
quit()
if __name__ == u'__main__':
root = Tk()
root.option_add(u'*tearOff', False)
root.geometry(u"700x400+300+300")
app = OfxConverter(root)
root.mainloop()
示例4: PraiseTexGUI
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import option_add [as 别名]
class PraiseTexGUI(object):
"""Graphical interface for selecting songs and compiling them"""
def __init__(self, songdir="songs"):
# data
self.songs = []
self.praisetex = PraiseTex(songdir)
self.root = Tk()
button_width = 6
button_padx = "2m"
button_pady = "1m"
frame_padx = "3m"
frame_pady = "2m"
label_padx = "3m"
label_pady = "2m"
listbox_width = 30
listbox_height = 20
frame_title_font = ("TkDefaultFont", 14)
text_font = ("TkDefaultFont", 12)
menu_font = ("TkDefaultFont", 12)
button_font = ("TkDefaultFont", 12)
# window properties
self.root.title("praisetex")
self.root.option_add("*Font", ("TkDefaultFont", 12))
# menu
menubar = Menu(self.root)
menubar.tk.call('tk', 'scaling', 2.5)
filemenu = Menu(menubar, tearoff=0)
filemenu.add_command(label="Open Directory", command=self.openDirectory)
filemenu.add_command(label="Exit", command=self.root.quit)
menubar.add_cascade(label="File", menu=filemenu)
self.root.config(menu=menubar)
# left section
self.availableSongsTitle = Label(self.root,
text="Available Songs",
font=frame_title_font,
padx=label_padx,
pady=label_pady)
self.availableSongsTitle.grid(row=0, column=0)
self.availableSongsFrame = Frame(self.root)
self.availableSongsFrame.grid(row=1, column=0,
padx=frame_padx, pady=frame_pady)
self.availableSongsScroll = Scrollbar(self.availableSongsFrame,
orient=VERTICAL)
self.availableSongs = Listbox(self.availableSongsFrame,
width=listbox_width,
height=listbox_height,
selectmode=EXTENDED,
yscrollcommand=self.availableSongsScroll.set,
exportselection=0)
self.availableSongsScroll.config(command=self.availableSongs.yview)
self.availableSongsScroll.pack(side=RIGHT, fill=Y)
self.availableSongs.pack()
self.button = Button(self.root,
text="Refresh",
command=self.refreshSongList)
self.button.grid(row=2, column=0)
# middle section
self.addRemoveButtonFrame = Frame(self.root)
self.addRemoveButtonFrame.grid(row=1, column=1)
self.addSongButton = Button(self.addRemoveButtonFrame,
text="Add",
command=self.addSong)
self.addSongButton.pack(side=TOP, padx=button_padx, pady=button_pady)
self.removeSongButton = Button(self.addRemoveButtonFrame,
text="Remove",
command=self.removeSong)
self.removeSongButton.pack(side=BOTTOM)
# right section
self.songsToCompileTitle = Label(self.root, text="Songs to Compile",
font=frame_title_font,
padx=label_padx, pady=label_pady)
self.songsToCompileTitle.grid(row=0, column=2)
self.songsToCompileFrame = Frame(self.root)
self.songsToCompileFrame.grid(row=1, column=2,
padx=frame_padx, pady=frame_pady)
self.songsToCompileScroll = Scrollbar(self.songsToCompileFrame,
orient=VERTICAL)
self.songsToCompile = Listbox(self.songsToCompileFrame,
width=listbox_width,
height=listbox_height,
selectmode=EXTENDED,
yscrollcommand=self.songsToCompileScroll.set,
exportselection=0,
font=text_font)
self.songsToCompileScroll.config(command=self.songsToCompile.yview)
self.songsToCompileScroll.pack(side=RIGHT, fill=Y)
self.songsToCompile.pack()
self.compileButtonFrame = Frame(self.root)
self.compileButtonFrame.grid(row=2, column=2)
self.chordsButton = Button(self.compileButtonFrame,
text="Chords",
#.........这里部分代码省略.........
示例5: Tk
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import option_add [as 别名]
from configgui import ConfigGUI
import configgui
import cloudsensor
import imagescheduler
import focuser
import neocphelper
if (platform.architecture()[0] == '64bit' and
"Windows" in platform.architecture()[1]):
logger.warning("We can't run on 64bit windows sorry")
sys.exit(1)
# Set up the root window
root = Tk()
root.option_add('*tearOff', FALSE)
root.title("AutoSkyX")
# Set up Notebook tabs
n = ttk.Notebook(root)
f1 = ttk.Frame(n)
f1.grid(column=0, row=0, sticky=(N, S, E, W))
f1.columnconfigure(0, weight=3)
f1.rowconfigure(0, weight=3)
f2 = ttk.Frame(n)
f2.grid(column=0, row=0, sticky=(N, S, E, W))
f2.columnconfigure(0, weight=3)
f2.rowconfigure(0, weight=3)
f3 = ttk.Frame(n)
f3.grid(column=0, row=0, sticky=(N, S, E, W))
f3.columnconfigure(0, weight=3)
示例6: update_msgbox
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import option_add [as 别名]
def update_msgbox(title, msg):
localRoot = Tk()
localRoot.withdraw()
localRoot.option_add('*font', 'Helvetica -12')
localRoot.quit()
return tkinter_msgbox.showinfo(title, msg)
示例7: GUI
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import option_add [as 别名]
class GUI(object):
def __init__(self, gen, config, preset_dir):
# These will be set later (might consider removing them?)
self.deviceIP = ""
self.devicePort = 0
self.applicationPort = 0
self.config = config
self.preset_dir = preset_dir
self.generator = gen
try:
self.__root = Tk()
screen_w = self.__root.winfo_screenwidth()
screen_h = self.__root.winfo_screenheight()
window_w = self.config["window_width"]
window_h = self.config["window_height"]
off_w = (screen_w - window_w) / 2
off_h = (screen_h - window_h) / 4
# use 4 instead of 2
self.__root.geometry("%dx%d+%d+%d" % (window_w, window_h, off_w, off_h))
# Delete Window callback
self.__root.protocol("WM_DELETE_WINDOW", self.exitCallback)
self.__window = self.__root
self.__root.wm_title("iPhoneComposer")
self.__root.option_add("*tearOff", FALSE)
# Create menu
menubar = Menu(self.__root)
preset_handlers = self.makeShowPresetHandlers()
self.__root.config(menu=menubar)
optionsMenu = Menu(menubar)
menubar.add_cascade(label="Options", menu=optionsMenu)
optionsMenu.add_command(label="Show internal state", command=self.showInternalState)
presetMenu = Menu(menubar)
menubar.add_cascade(label="Presets", menu=presetMenu)
for i in xrange(12):
presetMenu.add_command(label="Show preset %d state" % (i + 1), command=preset_handlers[i])
# Add an output list that may be accessed publicly
mainframe = Frame(self.__window, bd=2, relief=SUNKEN, width=500, height=400)
# Output frame
outputframe = Frame(mainframe, relief=SUNKEN, width=500, height=200)
self.outputscrollbar = Scrollbar(outputframe)
self.outputscrollbar.pack(side=RIGHT, fill=Y)
Label(outputframe, text="Output").pack(side=TOP)
self.output = Text(outputframe, bd=0, yscrollcommand=self.outputscrollbar.set)
self.output.pack(pady=(10, 10), padx=(10, 10))
self.output.configure(yscrollcommand=self.outputscrollbar.set)
self.outputscrollbar.configure(command=self.output.yview)
outputframe.pack_propagate(0)
outputframe.pack(fill=None, expand=False)
# OSC frame
oscframe = Frame(mainframe, relief=SUNKEN, width=500, height=200)
self.oscScrollbar = Scrollbar(oscframe)
self.oscScrollbar.pack(side=RIGHT, fill=Y)
Label(oscframe, text="OSC").pack(side=TOP)
self.osc = Text(oscframe, bd=0, yscrollcommand=self.oscScrollbar.set)
self.osc.pack(pady=(10, 10), padx=(10, 10))
self.osc.configure(yscrollcommand=self.oscScrollbar.set)
self.oscScrollbar.configure(command=self.osc.yview)
oscframe.pack_propagate(0)
oscframe.pack(fill=None, expand=False)
mainframe.pack_propagate(0)
mainframe.grid(row=1, column=0)
# Create the buttons
buttonPane = PanedWindow(self.__window, orient=VERTICAL)
buttonPane.grid(row=2, column=0)
self.__createButtons(buttonPane)
buttonPane.pack_propagate(0)
# Create the connection fields
connectPane = PanedWindow(self.__window, orient=VERTICAL)
connectPane.grid(row=3, column=0)
self.__createConnect(connectPane)
except:
t, v, tb = sys.exc_info()
traceback.print_exception(t, v, tb)
self.__root.quit()
quit()
def set_midi_output(self, midi_output):
self.__midi_output = midi_output
def set_touch_osc(self, touch_osc):
self.__touch_osc = touch_osc
def raise_above_all(self, window):
window.attributes("-topmost", 1)
window.attributes("-topmost", 0)
def showInternalState(self):
self.showState(self.generator.state, "Application Internal State")
def makeShowPresetHandlers(self):
#.........这里部分代码省略.........