Friday, May 23, 2014

1. Introduction to Kivy

Kivy is a python library designed to write mobile applications for the Android, ios, and other platforms.




This is the homepage of the Kivy program.




From the homepage, you can click on Downloads which will go to this page. If you are using Windows, you may download the zip. Using the zip file will not install anything on your computer, or change its settings, other than extracting a folder with many subfolders. To use Kivy you will have to use the executable file kivy.bat. The zip file contains a Python language program.




However, for my examples, Kivy is used on Linux. For running Kivy code it does not make any difference if you use Windows or Mac. You may install Linux Ubuntu, its most popular distribution, on any Windows or Mac computer. It is also possible to create a dual boot system, explained on the Ubuntu site which also gives instructions to create a bootable CD or DVD. Since the code will be compiled into Android or other language, it really does not make a difference. But with Linux you have access to more programming tools.




Once Ubuntu has been installed, you can search for idle. idle is a Python development environment. Python and idle should have been installed alongside Ubuntu. When idle is launched by clicking on the search result, you can right-click on the icon to Lock it to Launcher.




In the idle window, you can write import kivy. If it is already installed it will give the version name. If it is not installed, you will get an error.




If Kivy is not installed, you may open the program Synaptic Package Manager which can be opened by searching for synaptic and clicking on the result. Then you can search for Kivy. Then, you may enter a checkmark, next to Kivy, and it will install it, and its dependencies. After clicking on python Kivy, and selecting Apply, it should be filled with green color as shown here, which indicates successful install.




On the Kivy homepage at bottom, they have the simple Hello World application. There are 4 steps in writing this application. First the Application class is imported. This will always be required in any program you write, since your program has to borrow its functionality.




The next two steps are written here. We import the Button class. This is only required if your application uses at least 1 button. Next, we define our Test Class. It is a child, that is, it inherits the functionality of App. Next we override one function of the App class. The function is build which will always be overriden. The word self refers to the parameter passed by App class to it. Here, we return a Button, so that it may be displayed. In more realistic examples, covered later, you will return a class where your widgets, such as buttons, are located.




To run an application, we have to create an instance referring to the subclassed App, and then call the run() method on it. We can see the Button. You can click on it and it will become blue, momentarily. It will not do anything as you have not defined any event behavior.




The run() function is inside the App class, as is the function build(). You can get help on build using the help() command. It will show that it is called only once.




11 comments:

  1. Saw a few of your YouTube videos and I wanted to thank you for the great coverage.

    ReplyDelete
  2. just begin reading. thank you for sharing.

    ReplyDelete
  3. Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.

    Python Training in electronic city

    ReplyDelete
  4. Healrun is a health news blog we provide the latest news about health, Drugs and latest Diseases and conditions. We update our users with health tips and health products reviews. If you want to know any information about health or health product (Side Effects & Benefits) Feel Free To ask HealRun Support Team.

    ReplyDelete
  5. Supplements For Fitness that this product gave them more energy, extreme results and a younger appearance, and who does not?I included tea among my top five because I felt it was a good complement to any weight loss

    ReplyDelete
  6. Pilpedia is supplying 100 percent original and accurate information at each moment of time around our site and merchandise, and the intent is to improve the usage of good and pure health supplement. For More Info please visit Pilpedia online store.

    ReplyDelete
  7. For the purpose of learning digital marketing you have come to the right place my friend. You, yes you my friend can be the first person to join this amazing program and then learn about the ins and outs of digital marketing. Digital marketing is a growing field in the economy and the people in this Academy are experts at producing other experts who will master this subject and then start their own business by joining the facebook advertising page. This Quit 9 to 5 Academy Review will let you know everything there is to know about this subject and then you too can start a business.

    ReplyDelete
  8. Abundance Manifestor Guide is an online program aimed at those who want to change their lives. It is one of the latest guides that revolves around the law of attraction

    ReplyDelete

  9. Suplementarios >>> La autenticidad de nuestro sitio web es claramente visible a través de los blogs de moda de salud con el nombre mencionado en él. Tenemos una tendencia a ofrecer nuestro mejor apoyo a los huéspedes que buscan detalles de los suplementos y las comparaciones entre ellos. Para más información amable >>> http://suplementarios.es/

    http://suplementarios.es/erozon-max/

    http://suplementarios.es/reduslim/

    https://www.facebook.com/Suplementarios-2251727545101681/

    ReplyDelete
  10. I have one Male Enhancement that I don't leave to Male Enhancement. Rather honestly, your Male Enhancement is a Male Enhancement. I actually have to avoid wasting smart individuals from being burned by Male Enhancement scams though it just happened recently to me. That's the honest truth. Vialift Xl That sounds like a huge loser for Male Enhancement. It is the worst case state of affairs.

    https://www.nutrifitweb.com/vialift-xl/

    https://www.nutrifitweb.com/

    ReplyDelete
  11. At closing, wellbeing is to be had these days for an entire slew of events. now could be an marvelous occasion to assume as it respects wellness. That may be one of the simplest recipes to get health to be greater commonplace. permit me to put it like that. this can make you need to drown your sorrows.



    https://www.nutrahealthpro.com

    https://www.facebook.com/nutrahealthpro

    https://twitter.com/nutrahealthpro

    ReplyDelete