Make this count!

Today I read up on how to create GUI calculator using Python (yep, done with Swift for now).

I referred to this for the full code as I have no idea where to start. I read through his code once to have an idea and I’m thrilled to say I understood most of it and I tried it out.

Well, first I had to install a third-party module called tkinter  (a standard Graphic User Interface (GUI) package) using by keying brew install homebrew/dupes/tcl-tk followed by brew install python –with-tcl-tk into Terminal. Based on what I read, there are several other toolkits available and once you learn the basics of tkinter, it is easy to adapt to the others.

I encountered a few syntax errors while working on it but they were easy to debug. One thing on that code that did not work for me was this:Screen Shot 2017-08-29 at 2.07.35 PM.png

When I ran it, it indicated the following:Screen Shot 2017-08-29 at 2.10.05 PM.png

So instead of that I used self.newdiv = self.div.encode().decode() and it worked! My end product looked like that:Screen Shot 2017-08-29 at 2.12.09 PM.png

This isn’t a code I wrote but reading the codes people wrote actually helps me see how the various concepts are being applied. I’m quite proud of myself for moving away from the books (something I’d so stubbornly hung on to). I use them as reference books now for when I come across concepts (for example, “Class” and  “Exception Handling”) that I needed clarifications on.

I’m eager to attempt another mini project! Any suggestions?

On a side note, I’m leaving for a vacation tomorrow and it’s unlikely I’ll be updating this space until I get back end next week. Hopefully the trip will bring me all the inspiration and motivation that I need to keep fighting!

giphy

2 thoughts on “Make this count!

  1. i would recommend at some point installing linux on *something.* i would say run it from q, but q is no longer supported on the mac (in linux it is qemu.)

    from swift and brew i can tell youre learning to code on a mac. thats fine, i was playing with my own g4 a few weeks ago: http://i.imgur.com/Cxhrf2Z.png but everything python is just a little more work on a mac. (even a newer, intel-based one.)

    im not trying to get you to switch platforms as much as explore python in different situations… when you can find the time. enjoy your journey, it is a great language.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s