Skip to main content
Associate
November 1, 2023
Solved

STM32MP157F-DK2 Cortex-A7 Input Interface Example

  • November 1, 2023
  • 2 replies
  • 1495 views

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.

Best answer by btank

Implemented my own C application for the demo.

2 replies

Associate II
April 6, 2024

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()

btankAuthorBest answer
Associate
June 7, 2024

Implemented my own C application for the demo.