I would like This is a help message:
in the following string to be displayed in bold.
help_message = """This is a help message:
Demo!"""
tk.messagebox.showinfo('Help', help_message)
Can this be done with """{}content""".format('some_style_string')
?
I have seen other examples use code like the following:
class color:
PURPLE = '\033[95m'
CYAN = '\033[96m'
DARKCYAN = '\033[36m'
BLUE = '\033[94m'
GREEN = '\033[92m'
YELLOW = '\033[93m'
RED = '\033[91m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
END = '\033[0m'
But all the examples seem to involve the use of print.
Can this be done with """{}content""".format('some_style_string')
No, it cannot. tk.messagebox
cannot show styled text.
I have seen other examples use code like the following...
No, that won't work either. Those are escape codes that are designed to be interpreted by an ansi terminal (or by the curses
package).
If you want styled text then you will have to create your own dialog with Toplevel
and some text, label, or canvas widgets.