Modifications

Sauter à la navigation Sauter à la recherche
Ligne 83 : Ligne 83 :     
== Définition de l'interface utilisateur ==
 
== Définition de l'interface utilisateur ==
{{traduction}}
+
Pour quelques astuces sur l'utilisation des widgets avec le framework vous pouvez consulter le script [https://github.com/fictorial/pygameui/blob/master/bin/pygameui-kitchensink.py kitchen sink (pygameui-kitchensink.py)] .
For some hints on how to use widgets within the framework take a look at the [https://github.com/fictorial/pygameui/blob/master/bin/pygameui-kitchensink.py kitchen sink (pygameui-kitchensink.py)] script.
     −
The basic principle is that you define a class that inherits from {{fname|ui.Scene}} and in the {{fname|__init__}} method you define all the widgets. A Scene is the full window, in our case the entire display (320,240).
+
Le principe de base c'est qu'il faut définir une classe qui hérite de {{fname|ui.Scene}} et dans la méthode {{fname|__init__}} vous définissez tous les widgets. Une ''Scene'' est une fenêtre compllète, dans notre cas c'est l'afficheur en entier (320,240).
   −
Each button's position and size is defined using a {{fname|ui.Rect}} and a text label is also supplied. An {{fname|on_clicked}} handler is then assigned - this handler is called when the button is clicked. In our case this is the {{fname|gpi_button}} method.
+
La poisition et la taille de chaque bouton est défini en utilisant {{fname|ui.Rect}} et un libellé (''text label'') est également disponible. Un gestionnaire d'événement {{fname|on_clicked}} (aussi appelé "''handler''" en anglais) est alors assigné - ce ''handler'' est appelé lorsque l'on clique sur le bouton. Dans notre cas, le ''handler'' est la méthode {{fname|gpi_button}} .
   −
The  {{fname|gpi_button}} method simply looks at the label of the button that's been clicked to determine which GPIO to set on or off.
+
La méthode {{fname|gpi_button}} vérifie simplement le libellé du bouton qui à été clické pour déterminer le GPIO qu'il faut allumer ou éteindre.
    
<syntaxhighlight lang="python">
 
<syntaxhighlight lang="python">
29 918

modifications

Menu de navigation