kivy_comment_faire_un_tas_de_chose
Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédenteProchaine révisionLes deux révisions suivantes | ||
kivy_comment_faire_un_tas_de_chose [2020/01/15 08:23] – [Comment lister tous les widgets dans le python] serge | kivy_comment_faire_un_tas_de_chose [2020/10/19 07:10] – Tag0 Added: python Removed: python3 serge | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | ======Kivy: Comment faire un tas de chose====== | + | ======Kivy: Comment faire un tas de chose ====== |
<WRAP center round box 60% centeralign> | <WRAP center round box 60% centeralign> | ||
**{{tagpage> | **{{tagpage> | ||
**[[http:// | **[[http:// | ||
</ | </ | ||
- | ===== Pourquoi kivy est-il traître | + | <WRAP center round box 40% centeralign> |
+ | **[[les_pages_kivy_en_details|Les pages Kivy en détails]]** | ||
+ | </ | ||
+ | ===== Comment chercher | ||
+ | ====Sur internet==== | ||
+ | * Dans la **[[https:// | ||
+ | * Dans un moteur de recherche: ça finit souvent par des posts sur stackoverflow, | ||
- | **Kivy masque | + | ====Une bonne solution: Les exemples des sources de kivy==== |
+ | | ||
+ | | ||
+ | * Rechercher dans les fichiers: si vous chercher " | ||
+ | |||
+ | =====Des explications avec les exemples | ||
+ | Une liste de scripts qui explique bien: | ||
+ | |||
+ | * **pos_hint** : [[https:// | ||
+ | * **bubble** : [[https:// | ||
+ | * **camera** : [[https:// | ||
+ | * **carousel** : [[https:// | ||
+ | * **mipmap** : [[https:// | ||
+ | * **text_size = textwrap** : [[https:// | ||
+ | * **text with markup** : [[https:// | ||
+ | * **popup** : [[https:// | ||
+ | * **scatter** : [[https:// | ||
+ | * **scrollview** : [[https:// | ||
+ | * **splitter** : [[https:// | ||
+ | * **tabbed panel = onglet** : [[https:// | ||
+ | * **text align** : [[https:// | ||
+ | * **video player** : [[https:// | ||
+ | * **ErrorPopup(Popup)** : [[https:// | ||
+ | * **Slider** : [[https:// | ||
+ | * **Clock** : [[https:// | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | =====Adapter la résolution dpi sur son PC===== | ||
+ | * Sur votre PC, définir la taille de votre fenêtre | ||
+ | < | ||
+ | from kivy.core.window import Window | ||
+ | # Les 3 lignes ci-dessous sont à commenter pour buildozer | ||
+ | # L' | ||
+ | k = 1.0 | ||
+ | WS = (int(1280*k), int(720*k)) | ||
+ | Window.size = WS | ||
+ | </ | ||
- | Par exemple: | + | Lancer le main.py avec: |
+ | KIVY_METRICS_FONTSCALE=1.2 python3 main.py | ||
+ | avec une valeur " | ||
- | * un argument qui manque dans un appel de méthode lève une erreur pour du python habituel, mais pas dans kivy. D'où un débogage rusé nécessaire ! | ||
=====Comment lister tous les widgets dans le python===== | =====Comment lister tous les widgets dans le python===== | ||
Ligne 22: | Ligne 67: | ||
print([type(widget) for widget in f.walk(loopback=True)]) | print([type(widget) for widget in f.walk(loopback=True)]) | ||
| | ||
- | Sortie de [type(widget) for widget in self.walk(loopback=True)] | + | Sortie de [type(widget) for widget in self.walk(loopback=True)] |
< | < | ||
<class ' | <class ' | ||
Ligne 34: | Ligne 79: | ||
<class ' | <class ' | ||
<class ' | <class ' | ||
- | <class 'kivy.uix.boxlayout.BoxLayout'>, | + | ...... |
- | <class 'kivy.uix.gridlayout.GridLayout'>, | + | |
- | <class ' | + | |
- | <class ' | + | |
- | <class ' | + | |
- | <class ' | + | |
</ | </ | ||
=====Comment passer d'une class à une autre===== | =====Comment passer d'une class à une autre===== | ||
Ligne 51: | Ligne 91: | ||
- | ===== La commande magique ===== | ||
- | |||
- | Dans Blender, le raccourcis magique c'est: | ||
- | **Ctrl + A** Apply the object' | ||
- | |||
- | Dans le *.kv, c'est: [[https:// | ||
- | |||
- | <code python> | ||
- | canvas: | ||
- | Clear | ||
- | </ | ||
Ligne 133: | Ligne 162: | ||
... | ... | ||
</ | </ | ||
+ | |||
+ | =====Button background_color===== | ||
+ | <code python> | ||
+ | Button: | ||
+ | background_normal: | ||
+ | background_color: | ||
+ | </ | ||
+ | |||
+ | =====Texte en gras dans un label===== | ||
+ | * **[[https:// | ||
+ | <code python> | ||
+ | Label: | ||
+ | canvas.before: | ||
+ | Color: | ||
+ | rgba: 1, 1, 1, 1 | ||
+ | Rectangle: | ||
+ | pos: self.pos | ||
+ | size: self.size | ||
+ | size_hint_y: | ||
+ | markup: True | ||
+ | text: ' | ||
+ | color: 1, 0, 0.5, 1 | ||
+ | </ | ||
+ | |||
+ | |||
===== Factory ===== | ===== Factory ===== | ||
Factory peut être utilisée pour enregistrer automatiquement toute classe ou module et en instancier des classes n' | Factory peut être utilisée pour enregistrer automatiquement toute classe ou module et en instancier des classes n' | ||
- | * **[[http:// | + | * **[[http:// |
===== Réception sur Android en Multicast ===== | ===== Réception sur Android en Multicast ===== | ||
Ligne 150: | Ligne 204: | ||
- | {{tag> | + | {{tag> kivy python |
kivy_comment_faire_un_tas_de_chose.txt · Dernière modification : 2022/11/19 09:49 de serge