cancel
Showing results for 
Search instead for 
Did you mean: 

STM32MP157F-DK2 Cortex-A7 Input Interface Example

btank
Associate

Hi, I recently got this board and learning about it. My demo application will be for Cortex-A7 core with linux.

I need to make application which takes input from user say I have Menu with 5 choices and user can provide the choice number. 

How can I configure this? I am looking for any examples if available. 

Do I need to configure any pins and re-build the kernel?

Any help will be appreciated, Thank you.

1 REPLY 1
ngoctoan150699
Associate III

u can run applycation with python3 

code 

import gi
from gi.repository import Gtk

class MenuWindow(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self, title="Menu Demo")
self.set_default_size(300, 200)
self.set_border_width(10)

vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6)
self.add(vbox)

# Tạo menu bar
menubar = Gtk.MenuBar()
vbox.pack_start(menubar, False, False, 0)

# Tạo menu "Options" và các mục con
options_menu = Gtk.Menu()
options_menu_item = Gtk.MenuItem(label="Options")
options_menu_item.set_submenu(options_menu)

for i in range(1, 6):
menu_item = Gtk.MenuItem(label=f"Option {i}")
options_menu.append(menu_item)
menu_item.connect("activate", self.on_option_clicked, i)

menubar.append(options_menu_item)

def on_option_clicked(self, widget, option_number):
print(f"Option {option_number} clicked")

if __name__ == "__main__":
win = MenuWindow()
win.connect("destroy", Gtk.main_quit)
win.show_all()
Gtk.main()