Sure, let's keep pushing a language that's getting into barely decent status this year so we can keep teaching programmers not to diversify on tools.
So we can have a text editor that consumes well over a GB of RAM and can't open a 2MB file, a server framework that learns nothing about the last 50 years of CS about concurrency and a bazillion mobile app development frameworks that can't beat Python and OpenGL in performance.
I have enough of a headache doing web development with it, why are real engineers pushing this everywhere?
I think Kivy has a lot of potential here. It's OpenGL based with its own API so the workflow is very different to Pygame's exposure of lower level blitting etc., but it's flexible and performant enough for simple games even if you implement things fairly naively, and in principle it can be extremely efficient. It's also neat that it's so easy to take your game (or other program) to mobile devices.
There's been some interesting work recently by one of the core developers to create a native kivy game engine, integrating with a version of the chipmunk physics engine and aiming to make standard game tools available (particles, optimised physics, many sprites etc.) at consistent high framerates but with a simple api that fits neatly with the rest of kivy. It's a work in progress (and no official release right now), but it should make even more advanced game stuff easy and performant, and it's already a nice demonstration that these things are possible.
If I wanted to try your physics example I'd have no problem starting with Kivy, and I think the stuff in the video would certainly be easy enough. Actually, I'd extend that statement generally and say that Kivy would be a fine tool for most or all of the simple games I see built in pygame. On the other hand, I can't deny it's a younger project (though growing rapidly, particularly recently), and there are not yet the many broad examples you can easily find for pygame.
Just for a few examples, there's a list of kivy projects on the kivy wiki. There are quite a few simple games on google play (partly since many people are drawn to kivy for its mobile development), like flat jewels which is quite polished.
Are you aware of Kivy? It's a lot better than pygame for mobile games (and IMO for just about anything else, but I'm a kivy dev so I could be biased about it).
> Python's way of drawing to the screen seems slow
Pygame uses sdl1, which is not bad for some things but is vastly slower than a modern opengl pipeline. Kivy's own graphics api is much more modern abstraction of opengl and pushes most computation to the gpu, so it doesn't have these problems.
Kivy is not perfect, and still has plenty of its own limitations (as does anything), I don't want to present it as necessarily solving your problems. But I do think python's mobile power should not be judged based on pygame.
I like to use Kivy for GUI stuff, but I always do it with Python 2.7, as it just works (I generally download everything from Python Unofficial Binaries Page, Kivy and Pygame in this case).
I think they do support Python 3 now though, but it's not quite as super simple as using the unofficial binaries downloads; see here.
Not compiled the way C is, but yes, if you want it to run on computers without having them muck with their Python installation, you can create executable installers that bundle the runtime with them.
I've been working in web-space too long and am not sure what the state of the art here is, but see
I beg to differ; http://kivy.org/#home >Kivy - Open source Python library for rapid development of applications that make use of innovative user interfaces, such as multi-touch apps.
-- >Kivy runs on Linux, Windows, OS X, Android and iOS.
As has been commented on /r/python before, it's been a long time since the last release and there are many changes including some that are big improvements. There's a blog post summary of some of these changes available here, which should make its way to the Kivy Planet blog shortly.
Edit: It's now available on the official Kivy blog.
Good god no, how is this getting so many upvotes?
If you want to create a real Android application with Python, use http://kivy.org/
SL4A is not worth using for anything other than command line based background scripts, you cannot create a GUI application with it because it doesn't have access to the APIs required for such a thing. Kivy does.
You CAN write full...production quality apps in Python just fine. Get started here: http://kivy.org/docs/guide/android.html
If you want a cross platform (Android, iOS, Windows, OS X, Linux) framework alternative to Java, try Kivy: http://kivy.org
It's the only cross platform framework with "audiostreams" microphone input support. Java can't even do microphone input on all five platforms anymore.
You can still write apps in any of those languages for iOS/OS X.
Python is the only iffy one for iOS but toolkits do apparently exist.
For C++ you've got access to a few different cross-platform UI toolkits but Qt is (in my opinion) the best one you can use on the desktop side of things and they offer Python bindings as well. JavaScript you have PhoneGap/Ionic/Titanium/React Native on the mobile side (and others), desktop side you've got Electron and I think one other toolkit that I can't remember (please don't make desktop apps with JavaScript though).
Making your apps feel as native as they would from a Swift/Objective-C application though is another challenge though.
I'm one of the kivy devs, so i'm obviously biased :P Kivy is definitly meant to allow exactly what your talking about in terms of non standard / media-rich gui's. Since all the rendering is in OpenGL, you can even get really crazy if you want (Maybe audio visualization in the background?)
the docs are at http://kivy.org/docs We're trying to improve the documentation as much as possible, so please feel free to open github issues if something isn't easy to understand. Our game programming contest just finished, and we're releasing the results when we are done looking at all the entries next week; then there will be a bunch of more example games to look at too.
Also if you want to use kivy, you can get help on the kivy-users google group or on #kivy on freenode. You can pm me too if you want :)
Anyways, whether you end up using kivy or not, good luck on the project; sounds like fun.
I use Kivy for my latest project, once you understand the .kv layout file its very powerful and it has a fantastic MIT based license. (I personally dislike all *GPL, LGPL+ based ones). But it wasn't easy, as their documentation is a bit lacking, oddly enough, the pdf of their API has more information than the website does.
I don't know about the others but the Cons on Python are very very wrong.
The more complex the application, the more complex the modules and packages
What?!
Extremely limited for UX/UI
No mobile platform support
Limited development resources
What on earth is saying here? Python is one of the most rich development languages ecosystem wise, from books to libraries to frameworks
Just my 2 cents
http://kivy.org/#home is a GUI (not gaming specific) library that runs on Windows, Mac, Linux, Android and iOS. It seems to be popular for making games in particular though.
I never used it though so can't say how good it actually is.
Another alternative is Pyglet but it hasn't been updated since 2012 I think, so it's probably not very useful to you.
Posts asking for help like this really belong in /r/learnpython. I'd recommend re-posting this there to get better results.
Anyway, I'd recommend taking a look at the official Python tutorial to start with, if you haven't. Once you have the basics down, try taking a look at Kivy for building user interfaces and simple 2D games (bonus: they'll work on both Windows/Mac/Linux and Android!).
Kivy has an active irc channel, #kivy on freenode, or the mailing lists are often the best place for other types of discussion. This page has the details for each of these.
It looks like this is a year or so old, and there have definitely been improvements in that time - mainly for the better!
One thing that isn't mentioned on the page (maybe in the video, I didn't watch it all) is kivy. It has its own advantages and disadvantages, but I personally found it very enjoyable to use and with a remarkably pleasant android build process.
You should look at kivy (http://kivy.org/#home), it's "write python, compile cross platform". They provide a whole bunch of widgets for you to use, or you can create your own if it doesn't exist. There is also a pretty big community behind this project.
I've only been studying programming as a hobby for roughly four months, things like IDEs and OOP are still a bit over my head so I didn't really think I'd get an application done for quite some time. But after a quick "android apps in python" search I found kivy which is a crossplatform "do it all" framework. If you're interested in making apps try some of the kivy tutorials.
the generic launcher allows you to put just the pyhon/kivy apps on your SD card, the launcher then shows you a list for all apps on your SD card which you can start from there.
If you create your own apk, it will make a stand alone app that just launches your app.
see the documentation here: http://kivy.org/docs/guide/packaging-android.html
Kivy is a GUI toolkit native to Python. All parts of it are coded in Python, with the exception of some Cythonized bits for performance. There is no underlying C/C++ code as there is with any other GUI toolkit (tk, QT) and no reliance on JS/CSS/web tech as with many of the browser based GUI features. Everything is Pythonic and you can achieve the same look on all platforms (important I think if the appearance of your app is an issue). The only downside is it does not use 'native' widgets, so for people who do not want to care about appearance at all and just match whatever is provided by the OS, it is not the tool for that.
I use Kivy. Documentation is scant and the setup process is... Interesting... at best, but you don't have much choice if you have your heart set on writing the app in Python.
Once you get Kivy working, by the way, it's fantastic.
-edit-
Oh and you'll need Buildozer, too.
Probably best not to rely on a framework which doesn't even provide a download link on their homepage; for all I know PyMob may very well be legitimate and just have a very strange distribution model, but I can tell you for a fact that frameworks like Kivy, for example, are real and relatively easy to get started with, with numerous existing projects built with them and decent documentation. Probably better to try something like that first.
You might be able to do something with Kivy. But, otherwise the Apple TV can't run traditional Python code / scripts. The same is true for iOS.
Keep in mind that tvOS is just a much, much more limited version of iOS. If you can't do it on iOS, you can't do it on tvOS.
If you can wait a while, one of the long term projects I'm working on is a home automation system with these same features.
I'm using Kivy for the touchscreen interface, with this 10 inch multitouch panel flush mounted on the wall where the thermostat used to be.
As my house has wildly varying temperatures in each room, I'm working on a zoning system where each room has its own temperature sensor and servos control the vent registers, opening and closing them to maintain even temperatures across the house. Each room's temperature is shown on the touchscreen.
The Pi has a built in hardware watchdog, but I don't quite trust it for such an important task. I'm using an Arduino Trinket to watch one of the Pi's GPIO pins for an alternating high/low. If it ever stops, the Arduino hard-resets the Pi.
Longer term, I'm looking to add home security, voice control for lights, garage door, etc.
A two year old and a new baby are really slowing the project down, but I eventually plan to document the entire thing!
There's also Kivy, which, along with some of these others mentioned, you can deploy as an android app! :D
I personally wouldn't learn any gui framework that didn't work with some sort of mobile. And ffs, not tkinter, unless you want to build apps from the 90's.
If I were going to do this today, I would go with Kivy since it seems to make some very nice UIs possible.
When it comes to non-MS desktop apps, I have previously worked with Tk and Fox and while those are workable and capable, I really didn't find them to be extraordinarily easy enough to use that I would recommend them.
YMMV and all that. Good luck!
Edit: On second thought, Tkinter docs have really improved since I used it (around 2000), and it seems to have been keeping up with the times as well. See this for a nice guided tour.
I am not sure if this is the answer, but when you introduce a measurement, instead of working in pixels (width=20
), you can work in density pixels (width='20dp'
). This takes into consideration the pixel density of the display [docs].
Kivy is great, and the friendly community on IRC (and here) is a major asset to the project.
Kivy's kv-language and properties + events functionality allow you to quickly build (and iterate on) views and interactions with minimal code, while still allowing you as much flexibility as desired.
The documentation isn't the best place (imho) to learn the API, but it is very useful once you know how kivy works in general. I think the recommended path is to do one of the tutorials first: http://kivy.org/docs/tutorials/pong.html
I followed the directions here for buildozer. Buildozer automatically gets all the dependencies for android (SDK, python-for-android, NDK, etc) and builds an apk. For me, at least, it seemed easier than using python-for-android directly.
> is there a way of running python within an android app
This is what kivy does (as already linked by chchan), though by embedding the python interpreter and letting you create the entire app with python so it runs on the phone as a normal app as far as android is concerned. It includes tools for directly accessing the android api including sensors.
> I'd ideally like to be able to use my Python script that uses Numpy/Scipy natively on the android phone.
Kivy's android bundling tools compile the entire python interpreter for android, and the app really does run as python (plus a java frontend displaying the output, but this is handled automatically). As part of this process it's possible to include arbitrary python modules, including those written with cython or even linking directly to C, but anything that requires compilation needs special treatment to properly cross compile. This is often quite easy and the build tools have pre-written recipes for many of these, including numpy, but I think scipy is unlikely to work any time soon because it has a relatively complex set of dependencies on the C/fortran/whatever scientific libraries that are not easy (read, 'probably very hard') to get working on android.
It's possible that SL4A would also help you, in that you could run a python script directly and use their api to access sensors etc. I don't know so much about this, and I'm not sure if they support numpy, though I think I've seen activity about that.
> Is this totally dumb? Is is possible?
I think it's absolutely possible and reasonable, with some caveats. One is that whichever way you try, you'll need to make some changes to work with the api of the tool you choose, possibly/probably including removing your numpy/scipy dependencies.
You want to write game for mobile platform? As far as I know the only python module that would allow this is kivy: http://kivy.org/
I think that multiplayer functionality is a bit too much to go for with your first app. Start with making clones of simple games, pong etc. Then, once you have enough experience, start making your app.
We are using it to prepare game levels for iOS games straight from PSD files (psd file is converted to a set of images and a json file with meta information that game engine can use); we are also developing a private kivy-based GUI app (very simple) for various tasks (e.g. mark a layer group as an "animation group" and export layers from this group to a texture atlas with animation frames).
A friend of mine recently demoed "not carrying a laptop" by combining a Google Nexus, hdmi-cable to a Dell pico-projector, and an apple bluetooth keyboard+trackpad, into an almost pocketable laptop alternative; mostly he ended up using connectbot to ssh somewhere real, but it's an interesting starting point.
For on-tablet or on-phone dev, you probably want to start with something like [kivy][http://kivy.org] or maybe pyside rather than Java in any case. Though /r/GoogleAppInventor has a UI that's kind of painful with a mouse but would work nicely with a multitouch screen...
Not for long: http://db-engines.com/en/ranking
If you want a cross-platform alternative to Java, try Kivy: http://kivy.org It's the only one with microphone input support on Android, iOS, OS X, Windows, and Linux.
I've always installed Kivy on Ubuntu using these instructions and PyCharm has always automatically picked it up; I never had to muck around with any settings. I've done it on multiple machines for both Python 2 and 3 with no hitches.
You can disable logging if you want. I think this is the instructions for interacting with the default kivy logger.
However, this doesn't normally come up, probably because people are writing gui apps and there's nothing in the terminal for it to obscure. It also doesn't keep outputting a great deal, you'd normally see all this initialisation stuff at the beginning of the script, you're getting it bit by bit because you're doing the less common thing of importing things one by one in a shell.
It's also very valuable output, many times a user's problem has been quickly diagnosed by having them just paste this important information. Actually, I notice you're using the pygame window provider, but would recommend using sdl2 now - this is the default in kivy 1.9. It doesn't affect any use of kivy, just that the pygame backend will eventually be deprecated and the sdl2 one is largely better and easier to install.
Unless the patches state a source by a comment at the top the issues were resolved by me, and I will gladly hereby use the MIT license itself it that works well for you? Note that some are a bit messy, so if you find a bug or improvement please tell!
At least one has been submitted upstream to the python tracker, but seems to linger due to hesitation to apply android-specific patches in python core.
Are you a kivy developer? Do you think it would be reasonable to try to support building kivy apps from inside Termux (so that Termux can be used on-device for source control and editing, and then build a kivy app)?
EDIT: Reading up on kivy (http://kivy.org/docs/guide/packaging-android.html#packaging-your-application-for-the-kivy-launcher), I guess Termux could be used to edit files under /sdcard/kivy/<yourapplication>
, and then use the kivy android launcher to run it (perhaps by an intent launched from a build script running under Termux)?
Well, there's quite a few, but yeah, not that many, presumably due to the difficulty of creating cross platform code where mobile is concerned. Here's a Python framework. As mentioned, Xamarin is C# (non-free). PhoneGap lets you treat apps like websites.
I've only ever used Xamarin, but I would imagine that pretty much every tool requires you to have an OS X machine if you want to target iOS, since Apple has shitty licensing requirements.
Python, in it's purest form, isn't compiled. It's interpreted. Meaning people would normally need to install Python to run what you wrote.
That's not to say that people have tried to make ways to make binaries out of them so that less versed people just double click something to run. cx_Freeze would come to mind as well Cython.
If you want to make something with UI, there's the bundled TKinter which comes with standard Python or the fancy ones like Kivy which would allow you to make games and such.
The touch object (documented here) includes opos
and related properties storing its original position, and pos
storing its current position, you can use this to get the direction of movement. Since you actually get the full vector change, you can also do stuff like ignore diagonals if you want.
Kivy and PyGame are 3rd party resources that have to be installed before you can import them in a script (they aren't included in the standard Python library)
Depending on what platform you're on (Windows, Mac, Linux), the installation procedures differ.
Kivy: http://kivy.org/docs/installation/installation.html Pygame: http://www.pygame.org/download.shtml
Also, Kivy can sometime be a bit weird about how you run scripts: http://kivy.org/docs/guide/quickstart.html
> is it possible to define multiple objects?
Sure, take a look HERE.
"""
Instead of having to repeat the same values for every button, we can just use a template instead, like so:
<MyBigButt@Button>: text_size: self.size font_size: '25sp' markup: True
<MyWidget>: MyBigButt: text: "Hello world, watch this text wrap inside the button" MyBigButt: text: "Even absolute is relative to itself" MyBigButt: text: "repeating the same thing over and over in a comp = fail"
"""
The three buttons created above will have the same properties listed in <MyBigButt@Button>. If you wanted, you can add a <MySmallButt@Button> for a second size and use that the same way.
Another nice thing about Kivy is that it is relatively easy to create your own widgets if the provided ones don't work. Many people have done this and have made them available in the Kivy Garden.
In terms of what you could do, I would look at building something in Kivy (http://kivy.org/#home). It's pretty simple, is cross-platform and isn't that hard to get compiled down to an android apk - to then use on your Android phone (which I have found it the selling point for most people wanting to learn to program).
Try Kivy. From their webpage, it's an...
> Open source Python library for rapid development of applications that make use of innovative user interfaces, such as multi-touch apps.
I made some really rudimentary games that my 6-year-old nephew beat in like 3 minutes, but hey, it's a start!
Thanks for this detailed answer! :)
Why would it be easy to distribute? Do you mean something like the Chrome Web Store? Would it also work as a standalone thing for Mac / Windows / Linux distributions like Ubuntu or Android? Do you use some kind of game library? (I have used Kivy for Python before, but that's not working in browsers sadly.)
Yeah, I agree that having to specify types is often just clutter. In Java you often see something like:
Tree tree = new Tree();
And it often makes things very hard if you want it to be flexible.
Well I can't see how Nimrod is cleaner than Python (echo is not a function, var before defining variables) and Python 3 is very clean. Still, Nimrod looks definitely better than JavaScript, C, C#, C++ or Java.
Im using Anaconda as a python installation.
Just followed this tutorial on installation.
However, when I run this page I example, i get the error:
[WARNING] [WinPygame ] SDL wrapper failed to import! [DEBUG ] [Window ] Ignored <sdl> (import error) [DEBUG ] [Window ] Ignored <x11> (import error) [CRITICAL] [Window ] Unable to find any valuable Window provider at all! [CRITICAL] [App ] Unable to get a Window, abort. Exception SystemExit: 1 in 'kivy.properties.dpi2px' ignored [CRITICAL] [App ] Unable to get a Window, abort.
Error which, according to Kivy's installation page , is solved by installing pygame.
So lets move to Pygame!
When i do on the command line:
import pygame
I get the following error:
from pygame.base import * ImportError: /home/manueslapera/anaconda/bin/../lib/libm.so.6: version `GLIBC_2.15' not found (required by /usr/lib/x86_64-linux-gnu/libpulse.so.0)
Which is an error i ABSOLUTELY cant fint a fix for.
So im afraid im forced to develop on Kivy using the slow VM :(
Absolutely! I'd also suggest getting involved with the /r/Python subreddit. One of the greatest things about Python is the community that surrounds it!
Python can pretty much do anything you can imagine. If you are interested in the science and math applications of programming, you should check out SciPy and NumPy. There's also (pardon the website designs, the modules are still good) robotics, games programming, Android app development with Kivy and pretty much anything you can put your mind to doing! Search for projects or modules for stuff you'd like to build :)
Oh wow, I never realized that. I've never actually gone through his courses, just watched his videos when I came a across a topic that I needed more clarification or simplification for, since he puts out topics in an easy-to-understand manner.
I actually got into programming through the book Invent With Python, but since OP would be needing to learn Java instead of Python for Android development, I decided to keep it out of my recommendations.
Then again, he could use something like Kivy if he wanted to make games for Android using Python.
There's absolutely no reason you should need admin privileges to author and execute python code with special libraries. It's all about configuring your environment.
PyGame doe not seem to offer the binaries in non-installer format. They all seem to be msi, exe, deb, rpm, ... Most of these installer packages can be extracted without the need to run the installer, but it may be a bit of leg work. Perhaps you can install them at home and grab the necessary components on a jump drive.
On the other hand, Kivy offers a zip format for getting the binaries. This is perfect for your use. Get the appropriate binaries for your version of python (match both platform and architecture.) Just extract, configure and go. Kivy even comes with .sh and .bat files to help you get the environment setup correctly. It's mostly about getting the PATH and PYTHONPATH variables set correctly.
For example, download the latest kivy binaries: http://kivy.org/#download
The way I've learnt a bunch of languages is to have my own 'Hello World' program that I write in every language.
Every time I learn a new language I write a program that produces random Settlers of Catan boards.
Each time I write the program I try to add a new feature or write it in a way that's particular to the language I'm writing it in.
Most recently I've been writing it in Python to better learn Kivy.
You don't.
You could use something like kivy but it's not straightforward as writing and deploying java code.
I suggest you drop python for mobile development and use native languages, for android that would be Java.
http://pyweek.org/u/richard has some of it. You can't see the current stuff though I'm afraid. I use http://pyglet.org/ and http://kivy.org/ for the OpenGL stuff; the library choice depends on the actual project.
You're a lucky man, I just discovered Kivy a few minutes ago. It's a cross-platform library to write applications in Python and it's open-source. If you could give us more info about your project, we might help you.
They don't mention anywhere what programming languages are supported. I had to dig through one of the example applications to find out it was Python. Do they have bindings for any other language? C or C++ specifically.
EDIT: Found in their FAQ that it's only Python. You would think they would post it on the front page of their site and repeat it everywhere.
its a python module/framework to build user interfaces. The focus is on gpu accelerated drawing for sweet graphics, and support for multi-touch / NUI (naturual user interfaces). Chekc out the gallery for some examples of applicatios that have been built using kivy: http://kivy.org/#gallery
hm, i am new to android development... so maybe i am misunderstanding requirements/features.
assuming i could play in an android vm with python, i followed the instructions here: http://kivy.org/docs/guide/packaging-android.html to install a demo app and the simple "hello world" from the quickstart: http://kivy.org/docs/guide/quickstart.html
both examples work fine on a linux desktop. then tried both with a git clone of python-for-android instead of the Kivy-XXX-android.zip.
so this is not supposed to work?
i can see that python modules are extracted in the debug log and my package is loaded, but then it fails with the quoted error. is opengl es 2.0 not enough to draw a simple button with kivy?
EDIT: i installed Kivy==1.0.9 via pip... do i need to get that: https://code.launchpad.net/~tito-bankiz/pgs4a/kivy ?
Kivy (http://kivy.org/) is a opengl es 2.0 toolkit that can be run in top of this project.
Python is just a language, this project have no "console", so if you want to show something to the user, you must draw something somewhere. This is where you can use Kivy because you can do OpenGL UI with it.
I do, but I'm one of the developers so I'm probably biased :P You can check out the examples in the github repo or documentation, or some realworld things build with it here: http://kivy.org/#gallery
I'm working on a tutorial for the contest on how to write multitouch Pong using kivy right now
NotionInk (http://notionink.com) has been actively contributing and I can't wait to see what they do with their upcoming Eden and Genesis : http://notionink.wordpress.com/2012/01/02/introducing-kivy/
From the README:
Introduction ------------
Kivy is a Python library for development of multi-touch enabled media rich applications. The aim is to allow for quick and easy interaction design and rapid prototyping, while making your code reusable and deployable.
Kivy is written in Python, based on OpenGL and supports different input devices such as: Mouse, Dual Mouse, TUIO, WiiMote, WM_TOUCH, HIDtouch, Apple's products and so on.
Kivy is actively being developed by a community and free to use. It operates on all major platforms (Linux, OSX, Windows, Android).
/!\ The main resource for information is the website: http://kivy.org
I found it amusing because that introduction has more information than the website does. It's a shame you have to go into the docs to find "what Kivy is all about and sets it apart from different solutions".
If you're coming at this completely GUI-framework-agnostic, you might want to check out this thread on Kivy?
"kivy is the most awesome framework (for any language) for creating stunning user interfaces with support for a wide variety of input modalities like multi-touch, object/marker/fiducial tracking, kinect/gestures. Packaging for windows (exe), osx (.app/.dmg), and android is now available for easy distribution of kivy apps. It's licensed under the LGPL, so you can use it in both open and closed source projects. Info, downloads, and extensive documentation available here: http://kivy.org/ official github repo: http://github.com/tito/kivy From the release notes: Kivy is a full featured framework for creating novel and performant user interfaces, such as multitouch applications, under the LGPL 3 license. The framework works on Windows, MacOSX, Linux and Android. iOS support is coming soon, and available to brave hackers in repos."
There's a focus on mobile features for sure, but it looks nice for more traditional use as well (GPU-accleration!)
KivyMD can’t run off of basic python modules. I’d refer to http://kivy.org/docs/installation/installation-windows.html#start-a-kivy-application for further help.
Another fix I’ve seen is just renaming it because Python won’t search inside your file for the dependency unless the naming structure is formatted correctly.
Just an FYI, if you really need help with programming, StackOverflow is there for you. Not reddit.
I would argue that Python may not be the best choice for this, but that aside, yes; django is still the best Python web framework as far as I know. for the mobile app piece you'll want to look at something like kivy
kivy can use SDL2 for a backend, provider
in their terminology, along with Pygame (AFAIK deprecated) and I don't remember what else. I've used it for a prototype, but it's a general purpose UI library, not a roguelike engine. So, no cool RL-specific stuff, but it's a rather good basis to build engine on, as some people in the comments did with PySDL2 and Pygame.
> I know Python pretty well but I'm pretty sure you can't write android apps with it
You actually can, the main option is Kivy. It has its disadvantages compared to native development, but it does work fine (and, being Python, has some advantages as well - though arguably less general). It can also perform fine for games, as demonstrated by the kivent game engine, but one of the disadvantages is the relatively small community so this kind of thing is less well explored than the more mainstream choices using java or the more popular game engines that let you target android.
The option_cls property points at the object that will be used for the spinner dropdown entries. You can replace it with your own class in which you configure the appearance etc. that you want.
As far as i know, your best bet to do what you're talking about in python is with Kivy or PyQt via pyqtdeploy.
PyQt and Kivy are python GUI frameworks that support compiling for android devices. How well they support this I can not say.
As far as "simple code" is concerned, you would want to choose one of those two resources (as i don't know how each work with android, i can't give you a recommendation), and learn the basics of building a GUI as well as the basics of the language. The app that you referenced is not trivial and not something you could really just throw together as a learning example, so you would want to start with simpler projects to get the hang of the framework before you dive into a full-blown application.
It looks like Kivy is having some trouble in creating the window and because the window never gets created, the app stops running.
Following this tutorial on their docs, I see some significant differences in how they've designed their app. It seems like kivy is supposed to do some things automatically that you're trying to do manually. Is there a particular reason you've designed it the way you have?
Perhaps try following the pong tutorial and see if you still have the same problem. If you don't, then see what lessons you can apply from the pong tutorial to your own code.
For more information go to this site -> http://kivy.org/
If you want a python interpreter I think this -> https://itunes.apple.com/us/artist/jonathan-hosmer/id485729875?mt=8&ign-mpt=uo%3D4
I don't know much info about iPhone/iPad Python development. If you love Python and willing to support Python and recommend it to everyone then I can give you the email address of Guido van Rossum the creator of Python programming language and you can ask Guido about anything related to Python.
Have you seen this page already?
http://kivy.org/docs/installation/troubleshooting-macosx.html
It appears to say:
1. Make sure that PyGame is installed in your kivy virtual environment
2. Try other PyGame OS X binaries
> I just closed and opened the terminal again and it defaulted to the root environment.
That is a normal behavior. The virtual environment is effective in a specific shell session unless you write it in a shell's login configuration file like a .bash_profile. When you close the terminal, the shell session is over and the virtual environment becomes invalid. When you open the terminal again, the new shell session begins.
By the way I misunderstood the kivyconda script for activating the kivy environment in the current shell. Instead, the kivyconda script starts a new shell session, then activates the kivy environment in the new shell. The kivy environment is effective in the new shell session only.
For example,
$ kivyconda -m pip install <modulename>
this command starts a new shell, activates the kivy environment, then executes pip install
command in the new environment. When the pip process ended, the shell session is terminated, then you return to the root environment in the former shell session.
$ kivyconda (...) >>>
this command starts a new shell, activates the kivy environment, then executes python
command in the new environment. It starts a python interpreter. When you ended the interpreter with exit() or ctrl+d, the shell session is terminated, then you return to the the root environment in the former shell session.
$ kivyconda yourapplication.py
Similarly, this command starts a new shell, activates the kivy environment, then executes yourapplication.py
in the new environment.
Therefore, it is a normal behavior that the kivy environment is not activated even if after you've executed kivyconda
command.
Please see this page too.
http://kivy.org/docs/installation/installation-macosx.html
I suspect that I confuse you. I'm terribly sorry.
Not sure what version of Python you're using, but if it's version 3 then be aware of this answer on their FAQ page:
However, be aware that while Kivy will run in Python 3.3+, packaging support is not yet complete. If you plan to create mobile apps for Android or iOS, you should use Python 2.7 for now.
As noted below, I've never used kivy myself, but reading http://kivy.org/docs/guide/packaging-android.html#packaging-your-application-for-the-kivy-launcher, I get the impression that you can use Termux to edit /sdcard/kivy/<yourapplication>
as described in the linked resource, and then launch the application using the kivy launcher.
I would go with Python via Kivy. You could crate a little app or game with only needing to know one language (python) instead of HTML/CSS/JS etc...
Kivy also has the added advantage of being portable, so all you need to do is extract and run the included kivy launcher!
I don't know how Windows works but Kivy claim to have a portable package for it that contains Kivy, Python, Pygame and some other stuff.
I agree about the state of Android development. What's sad is that I have a friend who's only done Android development and therefore doesn't realise how terrible the SDK and tools are. :-)
Could still be a fun exercise to try? If you know python then you can use the Kivy framework to build a interface, love using that for all my python frontends nowadays.
Unfortunately I cannot check out your app since I have no windows phone but it looks helpful!
Depends how dirty you wanna get your hands.
Pygame (or pyglet, which is a little less dated), will let you do what you want for sure, but you have to manage each pixel yourself; make sure you're drawing things in the right order, etc. It's not crazy difficult, but perhaps Kivy can do what you want? Check out the galleries, and see if it seems right for you, then check out some tutorials for whichever library you decide on.
Of course, I imagine Kivy is capable and extensible enough to definitely do what you want too, but I've found with interface framework libraries like that, sometimes it's just easier to drop to pygame and play with pixels.
Analyzing Darkhand
trust score 79.5%
Fun facts about Darkhand
Just for completeness: Kivy is a python gui framework that allows deployment to windows, linux, OS X, android and iOS. Thus it "feels" relatively "mobile-y", e.g. native touch and multitouch support. The look is distinct and not native to the platform (without styling), so it will probably not fit your problem.
Kivy is a framework. Usually you would want to run it as your point of entry, and call all other scripts after you have Kivy up and running.
If you really want to do this, I suggest loading your kv-tree lazily with the >Builder.load_file('path/to/file.kv')
or
>Builder.load_string(kv_string)
This looks like it's doable.
A quick google found me this:
https://mail.python.org/pipermail/python-list/2013-December/676082.html
A look there, made me search for a module named android, combined with kivy: https://groups.google.com/forum/#!topic/kivy-users/QkmdLmdY-bI
This looks perfectly doable, but you have to do the last bit of research (the how to do it) yourself. Also I'd like to add that this has nothing to do with Kivy per se.
Kivy is a wrapper for what's already there. It covers all of this:
http://kivy.org/docs/api-kivy.html
The airplane mode is android specific. If there's a module offering an interface for it on android's python, then you can play around with it.
Yah the design work is actually pretty great. I personally have never met the designers/developers of the app as they were at a different school. They used Kivi to develop the app. I worked on the backend api/servers/database that will be integrated soon to allow data acquisition (anonymous and secure) so that treatments can be more targeted to the individual. Currently there is no large scale data acquisition for haemochromatosis patients as it is such a rare disease.
Kivy has pretty good Windows support with your app compiled by pyinstaller.
We only provide a few basic widgets and expect you to construct your own more complicated ones. We do have a repository of complex widgets that users create and submit so others can re-use them, but due to app size considerations these are not included into Kivy by default.
/u/inclemnet above is your guy. His youtube series is a really good introduction. But I made a stop watch for you.
The Pong tutorial is also very straightforward.
To make small games, you might want to look into the pygame package. http://pygame.org/wiki/about
I haven't done it myself yet, but when you progress to a point where the pygame GUI is too constraining for you, you might want to move up to Kivy or PyQt. http://kivy.org/docs/gettingstarted/intro.html
Also, Python does have its UI library that does run on Android. It's called Kivi. Don't start her with that! Mobile apps are much harder to get into.
But there's definitely a path to making apps eventually.
You can start her with Invent your own computer games with Python, that'd be right at the correct level.
The important thing is to shorten the path as much as possible between starting out and making something which is rewarding and makes you want to dive deeper which is a good reason to keep mobile apps for much later. :)
What do you mean by "getting python games online is damn near impossible"?
While it's true that you can't really run Python games in a browser (as you can with Javascript), you can certainly make a program that people can download and run. Kivy can generate packages for Windows, Mac OS, even Android and iOS.
I've been using it for the past ten months. I'd suggest going through the tutorials on the website to get a feel for it.
It's the only gui work I have ever done, and my position is that the difficulty lies in understanding how gui frameworks are supposed to work, rather than understanding Kivy itself.
You can use py2exe or pyinstaller to make an exe.Or if you are using kivy,they have a detailed documentation on making a windows executable: http://kivy.org/docs/guide/packaging-windows.html
If performance doesn't matter much for your game then go with python otherwise I suggest using lua or c++
kv is hierarchical, yes. The example you posted should give you a rectangle with a button inside of a button (though I'm not sure if buttons inside of buttons work)
Example for kv <-> py interaction:
kv:
<Window1>
BoxLayout:
Button:
text: 'Test'
py:
class Ingame():
pass
For the screen thingy, I'd suggest you take a look at the Screen Manager (http://kivy.org/docs/api-kivy.uix.screenmanager.html) it's exactly what you need
> If i may ask, is there any easy to install way to use kivy in Ubuntu?
Use the kivy ppa, with the instructions at the top of http://kivy.org/docs/installation/installation-linux.html .
Kivy runs fine on ubuntu (indeed, many of our users use it), and it's also easy to compile from source. The virtual machine image we provide is mainly intended for windows users to do android pacakaging, which requires linux or osx.
I recommend taking a look at Kivy.
It's a Python library that allows you to have one codebase and port the code to either Android or iOS. Pretty cool.
I've been working with it for a few weeks and I really enjoy it. However, it isn't terribly popular, so it can be difficult to find answers to some common problems.
Well you don't have to use the user input. I don't think any GUI framework doesn't support them. Other than pygame you can also check out kivy or PyOpenGL.
>Also, are there any good ways (and frameworks) of building such demonstrations as web pages?
With python? Not really, you could generate the resulting images in python and then display them in browser but interactive or live demos where you'd show (for example) pygame output in html aren't really possible. Use javascript, maybe something like pyjs could work: http://pyjs.org/
I recommed Kivy because it's hardware-accelerated (it uses advanced OpenGL), it works on all platforms (Games wrote with it also work on mobile), and I like the Kv markup language.
After looking at Kivy, it looks great, however the .dmg that I downloaded and followed their instructions here: http://kivy.org/docs/installation/installation-macosx.html
And subsequently the .dmg didn't include Cython which led me here: https://groups.google.com/forum/#!msg/kivy-users/OHlwNvOuA6Y/oRDSPyduL2YJ
Attempting to solve via ChrisB's solution, but to no avail yet.
I downloaded Cython independently, but how do I make it play with Kivy so I can run "make" and finish the install on Kivy?
Why not just use the bundle provided at the site? It has everything you need ready to go.
Cython is not a compiler, it's a module that lets you write Python extensions in a variant of Python which is then translated to C and compiled, and hence Cython requires a C compiler. The bundle at the Kivy site includes MinGW, which is a Windows port of gcc, the GNU compiler collection, which includes a C compiler. Alternatively you can install cython binary packages from here, but you won't actually be able to build anything without a working C compiler.
The biggest problem I have with this list (besides the obvious of trying to rank languages in the first places) is the fact that there is a 'type' category. There is no reason I couldn't build a website in C++, and while I wouldn't necessarily recommend it, it is very much possible to write mobile apps in python. In other words, not only is the idea of rankings stupid, but the list is plain wrong. I would expect better from the IEEE.
Qt is a good way to go for the UI, though depending on what kind of UI you're interested in, Kivy might be an interesting alternative.
For packaging up applications on a Mac, look at cx_Freeze or py2app.
I think there's a lack of good resources for building desktop applications in Python. The course you mention sounds good, but something a bit easier to drop into would be useful. I might try to write a blog post about this.
i think QT would be fine, the problem is Apple has a rule against interpreters, however Kivy is Python and is allowed according to http://kivy.org/docs/guide/packaging-ios.html#faq
How can Apple accept a python app ? We managed to merge the app binary with all the libraries into a single binary, called libpython. This means all binary modules are loaded beforehand, so nothing is dynamically loaded.