Python Forum
how to change font size
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to change font size
#2
import tkinter as tk

root = tk.Tk()
root['padx'] = 8
root['pady'] = 4
tk.Label(root, text='Button with font and a size of10').pack()
btn = tk.Button(root, text='Button 1', font=('tahoma 10'))
btn.pack()

tk.Label(root, text='Button with font and size of 40', font=('verdana 20')).pack()
btn2 = tk.Button(root, text='Button 2', font=('verdana 40'))
btn2.pack()

tk.Label(root, text='Button with font and size of 20 and bold', font=('times 20 bold')).pack()
btn3 = tk.Button(root, text='Button 3', font=('times 20 bold'))
btn3.pack()
root.mainloop()
BashBedlam likes this post
I welcome all feedback.
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags


Reply


Messages In This Thread
how to change font size - by barryjo - Jan-26-2022, 05:08 PM
RE: how to change font size - by menator01 - Jan-26-2022, 05:19 PM
RE: how to change font size - by barryjo - Jan-26-2022, 07:16 PM
RE: how to change font size - by deanhystad - Jan-26-2022, 07:48 PM
RE: how to change font size - by menator01 - Jan-26-2022, 08:46 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Tkinter menu font size -method to change tonycat 2 7,975 Oct-11-2020, 02:43 AM
Last Post: tonycat
  [Tkinter] Trying to change font size w/o changing button size python63 3 10,005 Aug-05-2020, 01:04 AM
Last Post: Larz60+
  [PyQt] Increase text size and change color based on temp pav1983 5 3,271 Jun-22-2020, 10:52 PM
Last Post: menator01
  TKINTER - Change font color for night or day Ayckinn 2 3,959 May-24-2020, 09:25 PM
Last Post: Ayckinn
  [WxPython] How to change font color of SetHint or SetDescriptiveText? anistorian 5 4,017 Jun-19-2019, 05:30 PM
Last Post: Yoriz
  PyGtk3 why is Locale Folder Size Half of Module Size ? harun2525 1 3,679 Mar-09-2017, 03:46 AM
Last Post: Analyser

Forum Jump:

User Panel Messages

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