def __init__(self, parent: tkinter.Misc, textwidget_of_tab: tkinter.Text) -> None: self.textwidget = textwidget_of_tab self.canvas = tkinter.Canvas(parent, width=40, highlightthickness=0) textwidget.use_pygments_theme(self.canvas, self._set_colors) utils.add_scroll_command(textwidget_of_tab, "yscrollcommand", self._do_update) textwidget_of_tab.bind( "<<ContentChanged>>", lambda event: textwidget_of_tab.after_idle(self._do_update), add=True, ) textwidget_of_tab.bind("<<UpdateLineNumbers>>", self._do_update, add=True) # TODO: document this? self._do_update() self.canvas.bind("<<SettingChanged:font_family>>", self._update_canvas_width, add=True) self.canvas.bind("<<SettingChanged:font_size>>", self._update_canvas_width, add=True) self._update_canvas_width() self._clicked_place: Optional[str] = None self.canvas.bind("<Button-1>", self._on_click, add=True) self.canvas.bind("<ButtonRelease-1>", self._on_unclick, add=True) self.canvas.bind("<Double-Button-1>", self._on_double_click, add=True) self.canvas.bind("<Button1-Motion>", self._on_drag, add=True)
def on_new_tab(event: utils.EventWithData) -> None: tab = event.data_widget() if not isinstance(tab, tabs.FileTab): return overview = Overview(tab.right_frame, tab) textwidget.use_pygments_theme(overview, overview.set_colors) overview.pack(fill='y', expand=True)
def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) self.title = "Interactive Prompt" self.textwidget = tkinter.Text(self, width=1, height=1) self.textwidget.pack(side='left', fill='both', expand=True) textwidget.use_pygments_theme(self.textwidget) self.prompt = PythonPrompt(self.textwidget, (lambda: self.master.close_tab(self))) self.scrollbar = ttk.Scrollbar(self) self.scrollbar.pack(side='left', fill='y') self.textwidget.config(yscrollcommand=self.scrollbar.set) self.scrollbar.config(command=self.textwidget.yview) self.bind('<Destroy>', self._on_destroy, add=True)
def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) self.title_choices = ["Interactive Prompt"] self.textwidget = tkinter.Text(self, width=1, height=1) self.textwidget.pack(side="left", fill="both", expand=True) textwidget.use_pygments_theme(self.textwidget) self.prompt = PythonPrompt(self.textwidget, (lambda: self.master.close_tab(self))) self.scrollbar = ttk.Scrollbar(self) self.scrollbar.pack(side="left", fill="y") self.textwidget.config(yscrollcommand=self.scrollbar.set) self.scrollbar.config(command=self.textwidget.yview) self.bind("<<TabSelected>>", (lambda event: self.textwidget.focus()), add=True) self.bind("<Destroy>", self._on_destroy, add=True)
def __init__(self, parent: tkinter.Misc, textwidget_of_tab: tkinter.Text) -> None: self.textwidget = textwidget_of_tab self.canvas = tkinter.Canvas(parent, width=40) textwidget.use_pygments_theme(self.canvas, self._set_colors) utils.add_scroll_command(textwidget_of_tab, 'yscrollcommand', self._do_update) textwidget_of_tab.bind('<<ContentChanged>>', self._do_update, add=True) self._do_update() self.canvas.bind('<<SettingChanged:font_family>>', self._update_canvas_width, add=True) self.canvas.bind('<<SettingChanged:font_size>>', self._update_canvas_width, add=True) self._update_canvas_width() self._clicked_place: Optional[str] = None self.canvas.bind('<Button-1>', self._on_click, add=True) self.canvas.bind('<ButtonRelease-1>', self._on_unclick, add=True) self.canvas.bind('<Double-Button-1>', self._on_double_click, add=True) self.canvas.bind('<Button1-Motion>', self._on_drag, add=True)
def on_new_tab(event: utils.EventWithData) -> None: tab = event.data_widget() if isinstance(tab, tabs.FileTab): textwidget.use_pygments_theme( tab, partial(on_pygments_theme_changed, tab.textwidget)) tab.textwidget.bind('<<CursorMoved>>', on_cursor_moved, add=True)
def on_new_tab(tab: tabs.Tab) -> None: if isinstance(tab, tabs.FileTab): textwidget.use_pygments_theme( tab, partial(on_pygments_theme_changed, tab.textwidget)) tab.textwidget.bind("<<CursorMoved>>", on_cursor_moved, add=True)
def on_new_tab(tab: tabs.Tab) -> None: if isinstance(tab, tabs.FileTab): minimap = MiniMap(tab.right_frame, tab) textwidget.use_pygments_theme(minimap, minimap.set_colors) minimap.pack(fill="y", expand=True)