pyCalc | : computer : A GUI Calculator using Tkinter | Apps library
kandi X-RAY | pyCalc Summary
kandi X-RAY | pyCalc Summary
A simple calculator made using tkinter.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Calculate the form
- Clears all items
- Compute the factorial
- Undo the whole string
- Get num variables
- Main loop
pyCalc Key Features
pyCalc Examples and Code Snippets
Community Discussions
Trending Discussions on pyCalc
QUESTION
print("Welcome to The pyCalc")
print("For Addition press 1")
print("For Multiplication press 2")
print("For Subtraction press 3")
print("For Division press 4")
flag = 'y'
while flag == 'y':
x = float(input("Enter your Choice(1-4): "))
if x == 1:
a = float(input("Enter 1st Value: "))
b = float(input("enter 2nd Value: "))
c = a+b
print("Sum: ", int(c))
elif x == 2:
a = float(input("Enter 1st Value: "))
b = float(input("Enter 2nd Value: "))
c = a*b
print("Product: ", int(c))
elif x == 3:
a = float(input("Enter the 1st value: "))
b = float(input("Enter the 2nd value: "))
c = a - b
print("Difference: ", int(c))
elif x == 4:
a = float(input("Enter the 1st value: "))
b = float(input("Enter the 2nd value: "))
c = a // b
print("Quotient: ", c)
else:
print("error !")
flag = print(input("Do you want to calculate more(y/n)? : ", y))
if flag == y:
continue
...ANSWER
Answered 2021-Mar-13 at 18:44I have re-written your code because there were two issues:
- There's no such thing as
print(input(""))
flag = input("Do you want to calculate more(y/n)? : ")
should be outside else
QUESTION
Hopefully I am following the guidelines correctly here with my first question. I am trying to create a GUI with the MVC structure. I am having difficulty with understanding why my signals are not always being picked up by the controller. I know that there is just something simple that I'm missing. I'm attaching code from a simple calculator which I used as a guide. I removed most of the features to simplify this as much as possible. It is now only 3 of the original buttons and my own button. For debugging, I just have the value on the button printed out when you press it.
...ANSWER
Answered 2020-Nov-19 at 17:31The problem is caused because the PyCalcCtrl object is not assigned to a variable so it will be destroyed and therefore the "_printthis" method will not be accessible. On the other hand, when functools.partial is used then the object of the PyCalcCtrl class is assigned to the scope of that function, that's why it works.
The solution is to assign the PyCalcCtrl object to a variable:
QUESTION
I am trying to build a simple GUI using PyQT5, with 3 buttons to open file browsers and one more to run processing with the selected files, but I can't get my buttons to connect to the functions needed to carry this out.
In the Ctrl
class, the _connect_signals
function doesn't seem to be calling _input_select
. Can anyone help me figure out why?
ANSWER
Answered 2020-Sep-30 at 18:09The problem is that you are not keeping any persistent reference to the Ctrl()
instance you are creating. This results in python garbage collecting it as soon as the instance is created.
To solve the issue, just assign it to a variable:
QUESTION
I've just started learning python's tkinter module today. I'm making a basic calculator for practice. Currently I'm just making the actual GUI for it and the '0' button has margin on each side of it and I'm unsure why. Like I said, I just started learning it today. Can someone tell me why this is happening and also how to make it not?
Here is what it looks like:
Looking at the 0, there is margin on the left and right of the button.
Here is the code:
...ANSWER
Answered 2020-Aug-12 at 22:42When adding a widget (in this case a button) to the grid, you can add the sticky
parameter to make the button expand to fill the grid in any given direction. In this case, if you changed to:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install pyCalc
You can use pyCalc like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page