Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
tkinter
#1
Hello! I am new to tkinter and i am trying to make a calculator on my own. I made buttons for every number and action but i want to know how to make the numbers appear in horizontal order and in a certain space when clicking said buttton. I am also not sure how to make the program understand when i clicked a button so that it can perform the action(f.e. multiplication)Can u please help me figure it out?
Reply
#2
You could try this:
def show_number(x):
   .....code ...

button01 = Button(root,text='1',font='ARIAL',command=lambda: show_number(1))
button02 = etc...
Paul
It is more important to do the right thing, than to do the thing right.(P.Drucker)
Better is the enemy of good. (Montesquieu) = French version for 'kiss'.
Reply
#3
Out of interest, how are you learning how to use it? Doing something when a button is clicked seems like a fairly important thing so any tutorial or the docs should cover such things.
Reply
#4
(Aug-30-2020, 02:57 PM)DPaul Wrote: You could try this:
def show_number(x):
   .....code ...

button01 = Button(root,text='1',font='ARIAL',command=lambda: show_number(1))
button02 = etc...
Paul

Thank u i tried it + found a tutorial i hadnt seen before so i figured it out!

(Aug-30-2020, 03:05 PM)ndc85430 Wrote: Out of interest, how are you learning how to use it? Doing something when a button is clicked seems like a fairly important thing so any tutorial or the docs should cover such things.

Actually not many tutorials show that i had to search a lot to find one. But thanks a lot for ur response
Reply


Forum Jump:

User Panel Messages

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