Link to home
Start Free TrialLog in
Avatar of liamrichards
liamrichardsFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Making a GUI Calculator in Python with Tkinter

Hi,
i'm just starting out with python today, and am trying to make a basic calculator program in Python with the Tkinter gui module.

At the moment I have the buttons 1-9  and each one calls a separate function, i.e. OnButtonClick1, OnButtonClick2, etc.

However since they all basically do the same thing, and only the number is different, there must me an easier way to do this?
Is there any way that I can just have one function such as OnButtonClick which can determine which button was pressed and do its logic based on that?

Thanks,
ASKER CERTIFIED SOLUTION
Avatar of Roger Baklund
Roger Baklund
Flag of Norway image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial