Alex
0
Q:

how to change the text of a label in tkinter

#How to change the font of a label in Tkinter

#Import 
from tkinter import *

#Screen
window = Tk()
window.title("New Window")
window.geometry("300x250")

Label(window, text = "This is my new project in python!", font = ("Bahnschrift", 14)).pack()
#-------------------------------------------------------------------------------------------
#'font' tells python that we are going to do something with the font
#-------------------------------------------------------------------------------------------
#'()' are needed becuase that is just how python works
#-------------------------------------------------------------------------------------------
#'"___"' put your font name in the quotes
#-------------------------------------------------------------------------------------------
#10 put vyour fontsize after adding a comma after the font name
#-------------------------------------------------------------------------------------------
0
label_name.configure(foreground="blue")
-2
import tkinter.font as font

#create Font object
myFont = font.Font(family='Helvetica')

button = Button(parent, font=myFont)
#or
button = Button(parent)
button['font'] = myFont
0
put able.text = "this is a test" & vbnewline & "123"
0
$("#FIELDID").find("option:contains(\"OptionLabel\")").text('NewLabel');
0
def press():
    Instruction.config(text='Button Pressed')
-1

New to Communities?

Join the community