Sunday 24 September 2017

Python App 3: "Plong" For Windows



Another common problem I find with learning a programming language is how far you really need to get into learning a language before you get any useful returns in creating anything that even resembles an everyday Windows/Android game.

So, I was desperate to move on to something as an "Interlude" to my second Python app to investigate how difficult it actually would be to port some form of Python code into a ".exe" or ".apk" we are used to.

In my investigation, I discovered Kivy... Which acts as a library to create and compile apps to Windows, iPhone, Linux, Android and pretty much anything else you could name. So I dived into their Pong Game Tutorial

It was refreshingly simple to set up, as I had already used pip to set up PyCharm (pip feeling very similar to how something like apt-get works). Installing everything I needed was a breeze... Even typing, running and making changes to their code was quite easy considering I'd already had some deeper experience of Python now under my belt... I was probably at about the right part of my education to start "experimenting"!

The only fiddly part was subsequently completing their tutorial to Create A Package For Windows, only really fiddly because you had to manually park command prompt in the empty folder you wanted to compile to, manually add a name in the command you type in then manually edit the created ".spec" file to include the files of your project. I mean really it was easy stuff too, although used to the ease of projects up to now I only question why no-one has simplified this experience as of yet. Equally, it finally made me feel like doing "real" coding.

It spat out a "Plong.exe" file, I launched it... And it ran exactly as it did in PyCharm! Finally, I had created my first ever application! There are some things that niggle me, like the command prompt that opens before the actual game which I wish I could silence (saying that even Steam Games such as Metal Gear Solid V do the same thing). There is also the small fact it isn't completely mine, it is largely the unedited code from their website at the moment as I wanted to quickly progress to actually compiling the thing. But, actually, if you're an intermediate at computing like me (and barely an intermediate at programming) you'll actually find the whole compilation process pretty simple.

Plong.exe is available at https://github.com/GlitchWalker/Python-and-Kivy-Pong-Game/releases, and as always my source code is available at my GitHub

No comments:

Post a Comment