Help with simple UI
Hi guys, I'm brand new to programming. So my beginners textbook the other day had me create a simple program to convert Fahrenheit to Celsius or vise versa. But to get the answers it was all done in the console.
So let's say I wanted to make a UI for this equations, like you run the program and your presented with a full black screen and 3 white squares lined up vertically down the middle. The first square would have you type in the degrees in Fahrenheit, the second square would be your "compute" button and the last one would show you the answer.
So how would one do this in pythonista on iPad?
Pythonista has some built-in features that make creating GUIs a little easier, for example you can use normal text boxes and buttons, without needing to make them yourself with white squares. Working with GUIs is much more complicated than using the console though.
If your beginner's book just taught you how to write a temperature converter, then you're probably not very far into the book yet. That's because this kind of program can be written using simple Python features:
+-*/, and names/variables to store the data. Maybe you've already used an
elseblock or a
whileloop. But most likely you don't know yet what functions, classes and objects are, or what
importmeans. To write a program that has a GUI, you need to know the basics of those four things.
I'm not going to try to explain all of those things in this post - that would take way too long. Instead I'd suggest you continue with the next chapters of your book and stick with the console for now. Think about it this way - there's a reason why Python still has console input and output even though we have operating systems with nice-looking GUIs, and that's because the console is much less complicated and is very easy to use. There are many things that you can learn about Python with the console only, which you'll probably find more interesting than creating a GUI.
Proof of @dgelessus' point: An ugly, minimal GUI is 40 lines of code...