Ejemplo n.º 1
0
 def update_font(self):
     """Update the sidebar text font, usually after config changes."""
     font = idleConf.GetFont(self.text, 'main', 'EditorWindow')
     tk_font = Font(self.text, font=font)
     char_width = max(tk_font.measure(char) for char in ['>', '.'])
     self.canvas.configure(width=char_width * 3 + 4)
     self._update_font(font)
Ejemplo n.º 2
0
def _linenumbers_drag_scrolling(parent):  # htest #
    from idlelib.idle_test.test_sidebar import Dummy_editwin

    toplevel = tk.Toplevel(parent)
    text_frame = tk.Frame(toplevel)
    text_frame.pack(side=tk.LEFT, fill=tk.BOTH, expand=True)
    text_frame.rowconfigure(1, weight=1)
    text_frame.columnconfigure(1, weight=1)

    font = idleConf.GetFont(toplevel, 'main', 'EditorWindow')
    text = tk.Text(text_frame, width=80, height=24, wrap=tk.NONE, font=font)
    text.grid(row=1, column=1, sticky=tk.NSEW)

    editwin = Dummy_editwin(text)
    editwin.vbar = tk.Scrollbar(text_frame)

    linenumbers = LineNumbers(editwin)
    linenumbers.show_sidebar()

    text.insert('1.0', '\n'.join('a' * i for i in range(1, 101)))
Ejemplo n.º 3
0
 def update_font(self):
     font = idleConf.GetFont(self.text, 'main', 'EditorWindow')
     self.sidebar_text['font'] = font
Ejemplo n.º 4
0
 def update_font(self):
     if self.context is not None:
         font = idleConf.GetFont(self.text, 'main', 'EditorWindow')
         self.context['font'] = font
Ejemplo n.º 5
0
 def update_font(self):
     """Update the sidebar text font, usually after config changes."""
     font = idleConf.GetFont(self.text, 'main', 'EditorWindow')
     self._update_font(font)