Build A Text Editor Part 6 - Creating Bold and Italic Text - Python Tkinter GUI Tutorial #109

preview_player
Показать описание
In this video we'll create a toolbar with buttons that allow us to make our text bold or italics.

To add bold and italics text to our text box, we'll need to first define a new font, and then add as tag to the text widget with that new font. We'll do this for both bold and italics.

We'll also need to write some logic to determine whether the text was already bold or italics, and if so...un-bold or un-italics it.
Рекомендации по теме
Комментарии
Автор

Thanks so much for these John!

To anyone reading this in the future, if you don't want your programs to throw an error if you hit the Bold or Italics buttons without selecting anything, put "if my_text.tag_ranges("sel"): and then indent the function. At the end you can put "else: print("there is no selected text"). I'm no expert so this might not be best practice, was just getting annoyed by the error haha

aspeno
Автор

▶️ Watch Entire Tkinter Playlist ✅ Subscribe To My YouTube Channel:
▶️ See More At: ✅ Join My Facebook Group:
▶️ Get The Code

Codemycom
Автор

Thanks John, for always doing a great job. Honestly, I can't thank you enough

judeleon
Автор

Thank you, John! Your lessons are incredible and useful!

vitaliiseryi
Автор

You should add a notification system to the Django blog. Something like YouTube notification so when someone adds a new blog post it will automatically alert to everyone the website

farhanfaisal
Автор

nice one i was acctually looking for a video that showed how to do this so thanks!

mbn-code
Автор

wonderful, i used your examples but i see i can't get the control b and control i to work and also cannot do bold and italics at the same time?

fentonmsu
Автор

hi john! everyrthings really good, only thing is i am around 6:00 and can't seem to get the bold buttons and the other ones to appear?

oliversampson
Автор

These videos are great. They're really explanatory, and they provide a ton of information. I've just been having one problem with saving the formatting. When I save the file, it doesn't keep the formatting. I've tried changing the file type to a .doc file, but it still didn't work. How can I fix this?

nimishpatri
Автор

Make a video on ttk styles in Tkinter please

sanjayrajasreeraja
Автор

hey the bold thing didnt work for me please help

yaman
Автор

I can't open the file after I bold the text, it will either refuse to open or not show the bold.

abramdaniels
Автор

Hey John!! The code is great but the real thing is we can't change to italic after changing to bold for given text.

arunbeckham
Автор

whenever i try to use sel.first and sel.last it gives me a name error saying 'sel' isn't defined, any idea why?

noisexcorexnojo
Автор

Hi sir wonderful job done by you. But a single doubt that bold and italic button are not working with each other. Any solution

codindentation
Автор

where did the 'current_tags' come from. I'm getting an error.

stephenpalcic
Автор

Great lessons, thanks, but....In your 'bold_it' function you use a variable called 'current_tags', but I cannot find where this variable is declared or initialized.

MrBradyKelly
Автор

hi Mr. John. when I insert bold tags in my text and save the file those tags are not saved. when I reopen the file the text is correct but without the bold tag. I wanted to ask if this is normal?

fabiodefalco
Автор

Obviously, your content is Amazing!!
Can you please share this program ... I am still having that status bar issue and not able to find it.
Thank You so much for such videos

nisargchaudhary
Автор

But is it possible to have text which is bolded AND italics at the same time?

tontsa