Python tkinter.NONE Examples

The following are 8 code examples of tkinter.NONE(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module tkinter , or try the search function .
Example #1
Source File: asktext.py    From textext with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
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() 
Example #2
Source File: asktext.py    From textext with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
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 
Example #3
Source File: text_frame_gui.py    From pyDEA with MIT License 6 votes vote down vote up
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) 
Example #4
Source File: asktext.py    From textext with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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() 
Example #5
Source File: text_for_weights_gui.py    From pyDEA with MIT License 5 votes vote down vote up
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) 
Example #6
Source File: codeview.py    From thonny with MIT License 5 votes vote down vote up
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") 
Example #7
Source File: replayer.py    From thonny with MIT License 5 votes vote down vote up
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) 
Example #8
Source File: debugger.py    From thonny with MIT License 5 votes vote down vote up
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