<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to Complex Main Example</title><link>https://sourceforge.net/p/pirobot/wiki/Complex%2520Main%2520Example/</link><description>Recent changes to Complex Main Example</description><atom:link href="https://sourceforge.net/p/pirobot/wiki/Complex%20Main%20Example/feed" rel="self"/><language>en</language><lastBuildDate>Wed, 20 Mar 2024 03:31:04 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/pirobot/wiki/Complex%20Main%20Example/feed" rel="self" type="application/rss+xml"/><item><title>Complex Main Example modified by Benedict Jäggi</title><link>https://sourceforge.net/p/pirobot/wiki/Complex%2520Main%2520Example/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v7
+++ v8
@@ -128,6 +128,9 @@
 When you switch to the other menu with "--&amp;gt;", there should only be 4 buttons, where one can switch back ("&amp;lt;--") and the others do nothing.

 Now you learned how to switch between apps with the MENU_APP, the Face App and the Breakout game App. 
+
+---------------
+
 Learn how to create one of these shiny Apps for yourself with the [APP_TEMPLATE].

 Or go back [Home]
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Benedict Jäggi</dc:creator><pubDate>Wed, 20 Mar 2024 03:31:04 -0000</pubDate><guid>https://sourceforge.netdd2ece07def4a8a82b5fd9dba7403a9590b5b29e</guid></item><item><title>Complex Main Example modified by Benedict Jäggi</title><link>https://sourceforge.net/p/pirobot/wiki/Complex%2520Main%2520Example/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v6
+++ v7
@@ -11,15 +11,14 @@
 # Best is if you give your app the same name like the corresponding file name.
 # Each App-file has a class called App (if you do not rename it.)
 # You need to give an instance of the App as parameter.
+# Do that at the end of your Application File. It's just here for reference.
 APP_BASE.registerApplication("APP_Face", APP_Face.App())

 # import the menu app as "real" system app.
 import APP_MENU
-APP_BASE.registerApplication("APP_MENU", APP_MENU.App())

 # And just for fun, import a game app.
 import APP_GAME_Breakout
-APP_BASE.registerApplication("APP_GAME_Breakout", APP_GAME_Breakout.APP())

 ######## DONE IMPORTING ########

@@ -40,12 +39,14 @@
 # Our menu App does need some functional buttons. 
 # Let's set them up.
 # First create a menu.
-# You don^t have to but it's good practice.
+# You don't have to but it's good practice.
 # (A menu instance will be created on startup, which you can affect directly.)
+# A menu has a default of 3x2=6 buttons if not otherwise specified. See below.
 mainMenu = APP_MENU.cMenu()

 # another menu to switch to for example
-anotherMenu = APP_MENU.cMenu()
+# here, we set how many buttons there are: 2 buttons (x) on 2 lines (y) = 4 buttons.
+anotherMenu = APP_MENU.cMenu(2,2)

 # Then set up the menu functions.

@@ -59,20 +60,26 @@

 # "Exit" the menu
 def menuExitFunc():
-    BASE_APP.setCurrentApp(BASE_APP.underlyingApp)
+    APP_BASE.setCurrentApp(APP_BASE.underlyingApp)

 # switch to the breakout game
 def menuGameBreakoutFunc():
-     BASE_APP.setCurrentApp("APP_GAME_Breakout")
+     APP_BASE.setCurrentApp("APP_GAME_Breakout")

  # select another menu on touch.
 def menuSwitchFunc():
     global anotherMenu
     APP_MENU.CURRENT_MENU=anotherMenu
+    # maybe we call that from another App than the menu, set the menu as current App then.
+    # You don't need that if you are switching between menus in the MENU_APP, when it is the current running App.
+    # It's just here for reference.
+    APP_BASE.setCurrentApp("APP_MENU")

 def menuSwitchBackFunc():
     global mainMenu
      APP_MENU.CURRENT_MENU=mainMenu
+     # see comment above
+     APP_BASE.setCurrentApp("APP_MENU")

 ###### MENU ITEM SETTINGS #######

@@ -83,7 +90,8 @@
 mainMenu.setMenuItem(1, "SHOW MSG", menuShowMsgFunc)

 # set the switch back function to a button in anothermenu
-anotherMenu.setMenuItem(3, "&amp;lt;--", menuSwitchBackFunc)
+# It's on the top right with index 1, index 0 is top left from 4 buttons, so index 2 and 3 are the lower line.
+anotherMenu.setMenuItem(1, "&amp;lt;--", menuSwitchBackFunc)

 ###### SELECT MENU ######
 # Select the main menu.
@@ -94,6 +102,11 @@

 ########## DIRECT MENU ITEM SETTING ############
 # You can also set items in the CURRENT selected menu directly:
+# Let's do that for the rightmost buttons in the main menu.
+# Remember: The main menu has the default of 6 buttons but anotherMenu just has 4 buttons.
+# Or otherwise: The lower right button in the main menu has index 5 (0-5= 6 buttons) 
+# and in anotherMenu the same button has index 3 (0-3 = 4 buttons)
+
 APP_MENU.setMenuItem(3, "--&amp;gt;", menuSwitchFunc)
 APP_MENU.setMenuItem(5, "EXIT", menuExitFunc)

@@ -110,9 +123,9 @@

 You should now see a face when you start MAIN.py.
 If you click on the lower part, the MENU_APP shows up.
-There should be 4 buttons which 
-1. switches to Breakout, 2. shows a Message, 3. switches to another menu  and 4 returns  to the face app when touched.
-When you switch to the other menu with "--&amp;gt;", there should only be one button at the same place with text: "&amp;lt;--"
+There should be 6 buttons which 
+1. switches to Breakout, 2. shows a Message, 3. switches to another menu, 4 and 5 do nothing  and 6 returns  to the face app when touched.
+When you switch to the other menu with "--&amp;gt;", there should only be 4 buttons, where one can switch back ("&amp;lt;--") and the others do nothing.

 Now you learned how to switch between apps with the MENU_APP, the Face App and the Breakout game App. 
 Learn how to create one of these shiny Apps for yourself with the [APP_TEMPLATE].
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Benedict Jäggi</dc:creator><pubDate>Wed, 20 Mar 2024 03:30:35 -0000</pubDate><guid>https://sourceforge.net0129b36456baf485ad22063a7026c2b2a268d0ec</guid></item><item><title>Complex Main Example modified by Benedict Jäggi</title><link>https://sourceforge.net/p/pirobot/wiki/Complex%2520Main%2520Example/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v5
+++ v6
@@ -92,6 +92,7 @@
 # It's a safer way to create menu variables and select them.
 APP_MENU.CURRENT_MENU = mainMenu

+########## DIRECT MENU ITEM SETTING ############
 # You can also set items in the CURRENT selected menu directly:
 APP_MENU.setMenuItem(3, "--&amp;gt;", menuSwitchFunc)
 APP_MENU.setMenuItem(5, "EXIT", menuExitFunc)
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Benedict Jäggi</dc:creator><pubDate>Thu, 07 Mar 2024 11:22:49 -0000</pubDate><guid>https://sourceforge.net9921604c72ab659701437c54056c8d7dee5218fe</guid></item><item><title>Complex Main Example modified by Benedict Jäggi</title><link>https://sourceforge.net/p/pirobot/wiki/Complex%2520Main%2520Example/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v4
+++ v5
@@ -112,3 +112,8 @@
 There should be 4 buttons which 
 1. switches to Breakout, 2. shows a Message, 3. switches to another menu  and 4 returns  to the face app when touched.
 When you switch to the other menu with "--&amp;gt;", there should only be one button at the same place with text: "&amp;lt;--"
+
+Now you learned how to switch between apps with the MENU_APP, the Face App and the Breakout game App. 
+Learn how to create one of these shiny Apps for yourself with the [APP_TEMPLATE].
+
+Or go back [Home]
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Benedict Jäggi</dc:creator><pubDate>Thu, 07 Mar 2024 11:16:05 -0000</pubDate><guid>https://sourceforge.net16bc7571abfe56d8c58b11663f90b1431f752ec3</guid></item><item><title>Complex Main Example modified by Benedict Jäggi</title><link>https://sourceforge.net/p/pirobot/wiki/Complex%2520Main%2520Example/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v3
+++ v4
@@ -44,6 +44,9 @@
 # (A menu instance will be created on startup, which you can affect directly.)
 mainMenu = APP_MENU.cMenu()

+# another menu to switch to for example
+anotherMenu = APP_MENU.cMenu()
+
 # Then set up the menu functions.

 ####### MENU FUNCTIONS #######
@@ -61,7 +64,16 @@
 # switch to the breakout game
 def menuGameBreakoutFunc():
      BASE_APP.setCurrentApp("APP_GAME_Breakout")
-      
+
+ # select another menu on touch.
+def menuSwitchFunc():
+    global anotherMenu
+    APP_MENU.CURRENT_MENU=anotherMenu
+
+def menuSwitchBackFunc():
+    global mainMenu
+     APP_MENU.CURRENT_MENU=mainMenu
+     
 ###### MENU ITEM SETTINGS #######

 # set some buttons on the menu:
@@ -69,6 +81,9 @@
 # the upper 3 buttons have index 0 to 2, the lower 3 buttons have index 3 to 5
 mainMenu.setMenuItem(0, "BREAKOUT", menuGameBreakoutFunc)
 mainMenu.setMenuItem(1, "SHOW MSG", menuShowMsgFunc)
+
+# set the switch back function to a button in anothermenu
+anotherMenu.setMenuItem(3, "&amp;lt;--", menuSwitchBackFunc)

 ###### SELECT MENU ######
 # Select the main menu.
@@ -78,6 +93,7 @@
 APP_MENU.CURRENT_MENU = mainMenu

 # You can also set items in the CURRENT selected menu directly:
+APP_MENU.setMenuItem(3, "--&amp;gt;", menuSwitchFunc)
 APP_MENU.setMenuItem(5, "EXIT", menuExitFunc)

 ########## RUN THE SYSTEM ##############
@@ -93,5 +109,6 @@

 You should now see a face when you start MAIN.py.
 If you click on the lower part, the MENU_APP shows up.
-There should be 3 buttons which 
-1. switches to Breakout, 2. shows a Message and 3 returns  to the face app when touched.
+There should be 4 buttons which 
+1. switches to Breakout, 2. shows a Message, 3. switches to another menu  and 4 returns  to the face app when touched.
+When you switch to the other menu with "--&amp;gt;", there should only be one button at the same place with text: "&amp;lt;--"
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Benedict Jäggi</dc:creator><pubDate>Thu, 07 Mar 2024 11:07:58 -0000</pubDate><guid>https://sourceforge.net78a817d07d6bc7f81bca92963b118268aae999f5</guid></item><item><title>Complex Main Example modified by Benedict Jäggi</title><link>https://sourceforge.net/p/pirobot/wiki/Complex%2520Main%2520Example/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v2
+++ v3
@@ -1,4 +1,5 @@
 #Complex MAIN.py Example
+Back to [MAIN] (Simple example)
 ~~~
 import APP_BASE # This one is mandatory
 import UITools  # This is used to show an example message here.
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Benedict Jäggi</dc:creator><pubDate>Thu, 07 Mar 2024 10:56:35 -0000</pubDate><guid>https://sourceforge.net95dc7d21b7bdd16732e484706e881f8c7ce56b2f</guid></item><item><title>Complex Main Example modified by Benedict Jäggi</title><link>https://sourceforge.net/p/pirobot/wiki/Complex%2520Main%2520Example/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v1
+++ v2
@@ -60,11 +60,7 @@
 # switch to the breakout game
 def menuGameBreakoutFunc():
      BASE_APP.setCurrentApp("APP_GAME_Breakout")
-     # when we show a message, the game is paused. But it needs to be hidden 
-     # on touch, not on release, so that the player can play directly.
-     UITools.showMessage("","BREAKOUT", "Tap screen to play.", True)
-     
- 
+      
 ###### MENU ITEM SETTINGS #######

 # set some buttons on the menu:
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Benedict Jäggi</dc:creator><pubDate>Thu, 07 Mar 2024 10:50:44 -0000</pubDate><guid>https://sourceforge.net91aedfd76a2f6d255181cfe988615ffa65264dce</guid></item><item><title>Complex Main Example modified by Benedict Jäggi</title><link>https://sourceforge.net/p/pirobot/wiki/Complex%2520Main%2520Example/</link><description>&lt;div class="markdown_content"&gt;&lt;h1 id="complex-mainpy-example"&gt;Complex MAIN.py Example&lt;/h1&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;APP_BASE&lt;/span&gt; &lt;span class="c1"&gt;# This one is mandatory&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;UITools&lt;/span&gt;  &lt;span class="c1"&gt;# This is used to show an example message here.&lt;/span&gt;

&lt;span class="c1"&gt;####### APPLICATION RELATED STUFF ########&lt;/span&gt;

&lt;span class="c1"&gt;# import the face app as system app.&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;APP_Face&lt;/span&gt;
&lt;span class="c1"&gt;# Best is if you give your app the same name like the corresponding file name.&lt;/span&gt;
&lt;span class="c1"&gt;# Each App-file has a class called App (if you do not rename it.)&lt;/span&gt;
&lt;span class="c1"&gt;# You need to give an instance of the App as parameter.&lt;/span&gt;
&lt;span class="n"&gt;APP_BASE&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;registerApplication&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"APP_Face"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;APP_Face&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;App&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;

&lt;span class="c1"&gt;# import the menu app as "real" system app.&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;APP_MENU&lt;/span&gt;
&lt;span class="n"&gt;APP_BASE&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;registerApplication&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"APP_MENU"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;APP_MENU&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;App&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;

&lt;span class="c1"&gt;# And just for fun, import a game app.&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;APP_GAME_Breakout&lt;/span&gt;
&lt;span class="n"&gt;APP_BASE&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;registerApplication&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"APP_GAME_Breakout"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;APP_GAME_Breakout&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;APP&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;

&lt;span class="c1"&gt;######## DONE IMPORTING ########&lt;/span&gt;

&lt;span class="c1"&gt;# Then set the current running application:&lt;/span&gt;
&lt;span class="c1"&gt;# We show the robot face on startup.&lt;/span&gt;
&lt;span class="n"&gt;APP_BASE&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;setCurrentApp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"APP_Face"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="err"&gt;`&lt;/span&gt;

&lt;span class="c1"&gt;# And set the underlying ("system") App, which gets  called when you "exit" another app:&lt;/span&gt;
&lt;span class="c1"&gt;# It will be APP_Face here but it could also be APP_MENU for example.&lt;/span&gt;
&lt;span class="n"&gt;APP_BASE&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;underlyingApp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"APP_Face"&lt;/span&gt;&lt;span class="err"&gt;`&lt;/span&gt;

&lt;span class="c1"&gt;# APP_Face also has an underlying app which is called when you touch &lt;/span&gt;
&lt;span class="c1"&gt;# the lower part of the display. Call APP_MENU then.&lt;/span&gt;
&lt;span class="n"&gt;APP_Face&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;underlyingApp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"APP_MENU"&lt;/span&gt;

&lt;span class="c1"&gt;######## MENU RELATED STUFF ##########&lt;/span&gt;

&lt;span class="c1"&gt;# Our menu App does need some functional buttons. &lt;/span&gt;
&lt;span class="c1"&gt;# Let's set them up.&lt;/span&gt;
&lt;span class="c1"&gt;# First create a menu.&lt;/span&gt;
&lt;span class="c1"&gt;# You don^t have to but it's good practice.&lt;/span&gt;
&lt;span class="c1"&gt;# (A menu instance will be created on startup, which you can affect directly.)&lt;/span&gt;
&lt;span class="n"&gt;mainMenu&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;APP_MENU&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cMenu&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="c1"&gt;# Then set up the menu functions.&lt;/span&gt;

&lt;span class="c1"&gt;####### MENU FUNCTIONS #######&lt;/span&gt;

&lt;span class="c1"&gt;# Just show a message.&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;menuShowMsgFunc&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="c1"&gt;# last flag determines if the message will be hidden on touch (True) &lt;/span&gt;
    &lt;span class="c1"&gt;# or release (False) on the display. Default is release (mouseup).&lt;/span&gt;
     &lt;span class="n"&gt;UITools&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;showMessage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"This is the middle text."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Upper text."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Lower text."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# "Exit" the menu&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;menuExitFunc&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="n"&gt;BASE_APP&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;setCurrentApp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;BASE_APP&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;underlyingApp&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# switch to the breakout game&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;menuGameBreakoutFunc&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
     &lt;span class="n"&gt;BASE_APP&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;setCurrentApp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"APP_GAME_Breakout"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
     &lt;span class="c1"&gt;# when we show a message, the game is paused. But it needs to be hidden &lt;/span&gt;
     &lt;span class="c1"&gt;# on touch, not on release, so that the player can play directly.&lt;/span&gt;
     &lt;span class="n"&gt;UITools&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;showMessage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;"BREAKOUT"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Tap screen to play."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


&lt;span class="c1"&gt;###### MENU ITEM SETTINGS #######&lt;/span&gt;

&lt;span class="c1"&gt;# set some buttons on the menu:&lt;/span&gt;
&lt;span class="c1"&gt;# first is the index, then the text shown and finally the function to call.&lt;/span&gt;
&lt;span class="c1"&gt;# the upper 3 buttons have index 0 to 2, the lower 3 buttons have index 3 to 5&lt;/span&gt;
&lt;span class="n"&gt;mainMenu&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;setMenuItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"BREAKOUT"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;menuGameBreakoutFunc&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;mainMenu&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;setMenuItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"SHOW MSG"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;menuShowMsgFunc&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;###### SELECT MENU ######&lt;/span&gt;
&lt;span class="c1"&gt;# Select the main menu.&lt;/span&gt;
&lt;span class="c1"&gt;# If no menu is selected, it will use an internal one.&lt;/span&gt;
&lt;span class="c1"&gt;# But you can loose it when you select another menu!&lt;/span&gt;
&lt;span class="c1"&gt;# It's a safer way to create menu variables and select them.&lt;/span&gt;
&lt;span class="n"&gt;APP_MENU&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CURRENT_MENU&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;mainMenu&lt;/span&gt;

&lt;span class="c1"&gt;# You can also set items in the CURRENT selected menu directly:&lt;/span&gt;
&lt;span class="n"&gt;APP_MENU&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;setMenuItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"EXIT"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;menuExitFunc&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;########## RUN THE SYSTEM ##############&lt;/span&gt;

&lt;span class="c1"&gt;# Finally, initialize the system and run it:&lt;/span&gt;
&lt;span class="n"&gt;APP_BASE&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;initialize&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;running&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt;
&lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="n"&gt;running&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="n"&gt;running&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;APP_BASE&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;update&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="n"&gt;APP_BASE&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;quit&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;You should now see a face when you start MAIN.py.&lt;br/&gt;
If you click on the lower part, the MENU_APP shows up.&lt;br/&gt;
There should be 3 buttons which &lt;br/&gt;
1. switches to Breakout, 2. shows a Message and 3 returns  to the face app when touched.&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Benedict Jäggi</dc:creator><pubDate>Thu, 07 Mar 2024 10:49:46 -0000</pubDate><guid>https://sourceforge.net6a346c6896dec794e4f0076bc25fbe240d0aa7c1</guid></item></channel></rss>