i am. prcatising a small calculator application in tkinter i wanted to make the fonts look bigger without making the buttons bigger .Button should be just enough sized so that text occupies in it. I tried the code below but its not working.

i saw the solution posted on how increase font size in text widget?

but since it uses pack method it doesn't solve my problem. i want to do it using .place() method



from tkinter import *


mainwindow=Tk()
mainwindow.title("Calculator")
mainwindow.geometry('400x300+500+200')
mainwindow.config(bg='green')

inp=Text(mainwindow ,width=25,height=2)
inp.place(x=20,y=45)


k=30

w=3
h=2


o1=Button(mainwindow,text='1',width=w,height=h)
o1.place(x=k+10,y=100)
o2=Button(mainwindow,text='2',width=w,height=h)
o2.place(x=k+65,y=100)
o3=Button(mainwindow,text='3',width=w,height=h)
o3.place(x=k+120,y=100)
o4=Button(mainwindow,text='4',width=w,height=h)
o4.place(x=k+10,y=150)
o5=Button(mainwindow,text='5',width=w,height=h)
o5.place(x=k+65,y=150)
o6=Button(mainwindow,text='6',width=w,height=h)
o6.place(x=k+120,y=150)
o7=Button(mainwindow,text='7',width=w,height=h)
o7.place(x=k+10,y=200)
o8=Button(mainwindow,text='8',width=w,height=h)
o8.place(x=k+65,y=200)
o9=Button(mainwindow,text='9',width=w,height=h)
o9.place(x=k+120,y=200)
o0=Button(mainwindow,text='0',width=w,height=h)
o0.place(x=k+65,y=250)

plus=Button(mainwindow,text='+',width=1,height=1,font=('times new roman',60,'bold'))
plus.propagate(False)
plus.place(x=k+200,y=100)
plus.pack_configure(padx=100)
minus=Button(mainwindow,text='-',width=w,height=h)
minus.place(x=k+200,y=150)
mul=Button(mainwindow,text='X',width=w,height=h)
mul.place(x=k+200,y=200)
div=Button(mainwindow,text='/',width=w,height=h)
div.place(x=k+200,y=250)








mainwindow.mainloop()





All the texts that are on the button should be big enough like in the game of 'tic-tac toe' where its 'X' and '0'

0 Answers