Python Forum
tkinter scrolledtext formatting
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
tkinter scrolledtext formatting
#1
I am using tkinter's scrolledtext and I was wondering if it is possible to format some of the text inside of it, like making one word bold while leaving the rest normal.
Is this possible? If so, what is the best way to do it?
Reply
#2
I think the only way to do this in tkinter is to use the weight attribute of the font command
self.bigFont = tkFont.Font(family='times', size=24, weight='bold')
see: http://infohost.nmt.edu/tcc/help/pubs/tk...ersal.html
I would set up several fonts, and toggle between them.

wxpython (phoenix) does a much better job at this.
Reply
#3
try this one :

def create_scrolltext(self):
F_font = ('bold', 30)
scroll_w = 30
scroll_h = 10
scrollText = scrolledtext.ScrolledText(self, width=scroll_w, height=scroll_h, wrap = tk.WORD, font=F_font)
scrollText.config(bg='white', fg='blue')
scrollText.grid(column=0, columnspan=3)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Tkinter Gui ScrolledText Insert From Different Class whisperquiet 1 4,324 Jan-08-2019, 09:25 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020