Quantcast
Channel: Pimoroni Buccaneers - Latest posts
Viewing all articles
Browse latest Browse all 53830

Dot3k menu example - code to halt/reboot the Pi?

$
0
0

The second argument to the add_item method should be a function, in this case it looks like you're passing in a string.

This might work:

menu.add_item('Power off', lambda: call("sudo halt",shell=True))

The lambda keyword produces an un-named function wrapping the call to call() .


Viewing all articles
Browse latest Browse all 53830

Trending Articles