vendredi 24 mars 2017
Hello World
This is my first post, I will introduce you to the magnificent world of programming. Today I will be coming towards some basic knowledge that you might want to know. I will also come towards to the knowledge of making games and all sorts of things at the end of the year. Now to all programmers I would say, should be able to know what is "Hello World!". Hello World is some small message usually used for testing, this was initiated from the book "The C Programming Language de Brian Kernighan et Dennis Ritchie". The very first example of this book printed "hello, world" without any ponctuation or capital letters but just a comma.
This post will be talking about "How to program Hello World in Kivy". First, before starting our awesome programming, I am telling to everyone that Kivy is a library of Python firstly and secondly ..... let's do it !
Ok, here we have some basic programs to show Hello World (in Kivy first) :
import kivy
kivy.require('1.9.0') # replace with your current kivy version !
from kivy.app import App
from kivy.uix.label import Label
class MyApp(App):
def build(self):
return Label(text='Hello world')
if _name_ == '__main__':
MyApp().run()
Here I will explain you that we have:
- Imported the library Kivy
- Kivy requires a version and this version is 1.9.0 (for me) or above.
- From Kivy modules kivy.app and kivy.uix.label, we will import the classes App and then Label.
- We have created our classe MyApp based on App, its base class.
- Then we have defined build method and returned Label and its text.
When we run this program, _name_ will be '__main__', and the statement MyApp().run() will be executed.
Inscription à :
Publier les commentaires (Atom)
Poem : Windrush Generation
Windrush Generation Past glory of England Succes of this Nation Based on the strength of this land Many Jamaicans Find work, prosperity Have...
-
La poésie effet divers. L'effet divers des faits divers Les images des faits divers nous apprennent, sans avoir l'air, à ...
-
Les oiseaux et les enfants Sont la braise du levant Des le premier rayon de banc Qui filtre au bas de la nuit Ils prennent feu dans leur...
-
Aujourd'hui dans une étable le Sauveur est né. Chacun de nous est invite à venir l'adorer C'est Noёl, Paix sur terre. Gloire ...
Aucun commentaire:
Enregistrer un commentaire