What is the difference between .config() and .configure() in Tkinter

Viewed 2407

Im a beginner in python. Recently I finished the basics and now I'm trying to make some GUI applications. I have found many cases where we use config() and configure(). But what is the difference between config() and configure()?

I mean, in what cases config() should be used and in what cases should configure() be used. i have a small portion of my code here.

Code where Configure is used:

fontStyle = tkFont.Font(family="comic sans ms", size=15)


def zoomin_1():
    fontsize=fontStyle['size']
    fontStyle.configure(size=fontsize+5)


def zoomout_1():
    fontsize = fontStyle['size']
    fontStyle.configure(size=fontsize - 5)


def default_1():
    fontStyle.configure(size=10)

Code where config is used:

root.config(menu=mainmenu)
mainmenu.add_cascade(label="Edit", menu=Edit_menu)


Format_menu = Menu(mainmenu, tearoff = False)
Format_menu.add_command(label="Word Wrap", command= test_fun)
Format_menu.add_command(label="Font", command= test_fun)
root.config(menu=mainmenu)
mainmenu.add_cascade(label="Format", menu=Format_menu)

It would of great help if someone would clear this doubt.

2 Answers

Both are exactly the same, the only difference is, the difference in the name, I would just reccomend using .config() just to save a few typing characters ;-)

Config or configure brings the same results.

Related