Have written a GUI (touchscreen) for my Pi in Python 3 with tkinter. It works in fullscreen. I do not want to have an extra button for shutting down the Pi but when I push 2 buttons together. How can I manage this?

postet this question to https://stackoverflow.com/q/61162648/11119062

  • This is a general programming question and does not belong to Raspberry Pi. I think you will get faster better answers at stackoverflow.com
    – Ingo
    Commented Apr 11, 2020 at 18:59
  • thanx. thougt Pi-users have more experience with touchscreens...
    – czil
    Commented Apr 11, 2020 at 19:17
  • You are talking about a GUI (raspberry-pi-desktop). There is nothing said about a touchscreen. So what do you mean? Two buttons on a touchcreen, or in a GUI?
    – Ingo
    Commented Apr 11, 2020 at 19:22
  • Sorry, I meant a touchscreen. It's not easy to hold 2 buttons with one mouse.
    – czil
    Commented Apr 11, 2020 at 19:34
  • Thought I had was to create a global variable with the initial value of 0. Then in each buttons pressed callback action add one to the value and if the value equals 2 do your shutdown. In each buttons release action subtract 1 from the value. Sounds odd but I think that should work. No way to test as I needed a new disk rather than the screen this month :-(. If you get stuck with the code I’ll see if I can knock something up for you to test.
    – user115418
    Commented Apr 12, 2020 at 0:06


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.