本文整理汇总了Python中tkinter.NONE属性的典型用法代码示例。如果您正苦于以下问题:Python tkinter.NONE属性的具体用法?Python tkinter.NONE怎么用?Python tkinter.NONE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类tkinter
的用法示例。
在下文中一共展示了tkinter.NONE属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: cb_word_wrap
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NONE [as 别名]
def cb_word_wrap(self, widget=None, data=None):
self._text_box.configure(wrap=Tk.WORD if self._word_wrap_tkval.get() else Tk.NONE)
self._gui_config["word_wrap"] = self._word_wrap_tkval.get()
示例2: window_deleted_cb
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NONE [as 别名]
def window_deleted_cb(self, widget, event, view):
if (self._gui_config.get("confirm_close", self.DEFAULT_CONFIRM_CLOSE)
and self._source_buffer.get_text(self._source_buffer.get_start_iter(),
self._source_buffer.get_end_iter(), True) != self.text):
dlg = Gtk.MessageDialog(self._window, Gtk.DialogFlags.MODAL, Gtk.MessageType.QUESTION, Gtk.ButtonsType.NONE)
dlg.set_markup(
"<b>Do you want to close TexText without save?</b>\n\n"
"Your changes will be lost if you don't save them."
)
dlg.add_button("Continue editing", Gtk.ResponseType.CLOSE) \
.set_image(Gtk.Image.new_from_stock(Gtk.STOCK_GO_BACK, Gtk.IconSize.BUTTON))
dlg.add_button("Close without save", Gtk.ResponseType.YES) \
.set_image(Gtk.Image.new_from_stock(Gtk.STOCK_CLOSE, Gtk.IconSize.BUTTON))
dlg.set_title("Close without save?")
res = dlg.run()
dlg.destroy()
if res in (Gtk.ResponseType.CLOSE, Gtk.ResponseType.DELETE_EVENT):
return True
Gtk.main_quit()
return False
示例3: create_widgets
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NONE [as 别名]
def create_widgets(self):
''' Creates all widgets.
'''
self.grid_rowconfigure(0, weight=1)
self.grid_columnconfigure(0, weight=1)
xscrollbar = Scrollbar(self, orient=HORIZONTAL)
xscrollbar.grid(row=1, column=0, sticky=E+W)
yscrollbar = Scrollbar(self)
yscrollbar.grid(row=0, column=1, sticky=N+S)
self.text = Text(self, wrap=NONE,
xscrollcommand=xscrollbar.set,
yscrollcommand=yscrollbar.set)
self.text.bind("<Control-Key-a>", self.select_all)
self.text.bind("<Control-Key-A>", self.select_all)
self.text.grid(row=0, column=0, sticky=N+S+E+W)
xscrollbar.config(command=self.text.xview)
yscrollbar.config(command=self.text.yview)
示例4: word_wrap_toggled_cb
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NONE [as 别名]
def word_wrap_toggled_cb(self, action, sourceview):
sourceview.set_wrap_mode(Gtk.WrapMode.WORD if action.get_active() else Gtk.WrapMode.NONE)
self._gui_config["word_wrap"] = action.get_active()
示例5: create_widgets
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NONE [as 别名]
def create_widgets(self, weight_name):
''' Creates all widgets.
'''
constraints_lbl = Label(
self, text='Enter {0} weight restrictions:'.format(
weight_name))
constraints_lbl.grid(padx=10, pady=2, sticky=N+W)
examples_lbl = Label(self, text='e.g. {0}'.format(self.examples))
examples_lbl.grid(row=1, column=0, padx=10, pady=5, sticky=N+W)
errors_lbl = Label(self, textvariable=self.errors_strvar,
foreground='red', anchor=W, justify=LEFT,
wraplength=80)
errors_lbl.grid(row=2, column=2, sticky=N+W, padx=5, pady=5)
self.grid_rowconfigure(2, weight=1)
self.grid_columnconfigure(0, weight=1)
xscrollbar = Scrollbar(self, orient=HORIZONTAL)
xscrollbar.grid(row=3, column=0, sticky=E+W)
yscrollbar = Scrollbar(self)
yscrollbar.grid(row=2, column=1, sticky=N+S)
self.text = Text(self, wrap=NONE, width=TEXT_WIDTH_VAL,
height=TEXT_HEIGHT_VAL,
xscrollcommand=xscrollbar.set,
yscrollcommand=yscrollbar.set)
self.text.grid(row=2, column=0, sticky=N+S+E+W)
xscrollbar.config(command=self.text.xview)
yscrollbar.config(command=self.text.yview)
示例6: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NONE [as 别名]
def __init__(self, master, propose_remove_line_numbers=False, **text_frame_args):
super().__init__(
master,
text_class=CodeViewText,
undo=True,
wrap=tk.NONE,
vertical_scrollbar_style=scrollbar_style("Vertical"),
horizontal_scrollbar_style=scrollbar_style("Horizontal"),
horizontal_scrollbar_class=ui_utils.AutoScrollbar,
**text_frame_args
)
# TODO: propose_remove_line_numbers on paste??
assert self._first_line_number is not None
self._syntax_theme_change_binding = get_workbench().bind(
"SyntaxThemeChanged", self._reload_theme_options, True
)
self._original_newlines = os.linesep
self._reload_theme_options()
self._gutter.bind("<Double-Button-1>", self._toggle_breakpoint, True)
# self.text.tag_configure("breakpoint_line", background="pink")
self._gutter.tag_configure("breakpoint", foreground="crimson")
editor_font = tk.font.nametofont("EditorFont")
spacer_font = editor_font.copy()
spacer_font.configure(size=editor_font.cget("size") // 4)
self._gutter.tag_configure("spacer", font=spacer_font)
self._gutter.tag_configure("active", font="BoldEditorFont")
self._gutter.tag_raise("spacer")
示例7: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NONE [as 别名]
def __init__(self, master):
ttk.Frame.__init__(self, master)
self.vbar = ttk.Scrollbar(self, orient=tk.VERTICAL)
self.vbar.grid(row=0, column=2, sticky=tk.NSEW)
self.hbar = ttk.Scrollbar(self, orient=tk.HORIZONTAL)
self.hbar.grid(row=1, column=0, sticky=tk.NSEW, columnspan=2)
self.text = codeview.SyntaxText(
self,
yscrollcommand=self.vbar.set,
xscrollcommand=self.hbar.set,
borderwidth=0,
font="EditorFont",
wrap=tk.NONE,
insertwidth=2,
# selectborderwidth=2,
inactiveselectbackground="gray",
# highlightthickness=0, # TODO: try different in Mac and Linux
# highlightcolor="gray",
padx=5,
pady=5,
undo=True,
autoseparators=False,
)
self.text.grid(row=0, column=1, sticky=tk.NSEW)
self.hbar["command"] = self.text.xview
self.vbar["command"] = self.text.yview
self.columnconfigure(1, weight=1)
self.rowconfigure(0, weight=1)
示例8: get_text_options
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NONE [as 别名]
def get_text_options(self):
opts = dict(
height=1,
width=1,
relief=tk.RAISED,
background="#DCEDF2",
borderwidth=1,
highlightthickness=0,
padx=7,
pady=7,
wrap=tk.NONE,
font="EditorFont",
)
opts.update(get_syntax_options_for_tag("expression_box"))
return opts