Making it easier to click icons in X
If you want to double-click on icons to launch something in X you may find it annoying to get it to work right. In LXDE you can simply set it up so that you only need to single click instead of double.
From LXDE launch the file manager (sorry these pix are grayscale, still figuring out how to screenshot the framebuffer!)
Right-click on a touchscreen
Obviously if you have a touchscreen, it cannot tell what finger you are pressing with. This means that all 'clicks' are left clicks. But if you want a right-click, you can do it.
Just add the following lines into your InputClass of /etc/X11/xorg.conf.d/99-calibration.conf after the calibration section
Option "EmulateThirdButton" "1"
Option "EmulateThirdButtonTimeout" "750"
Option "EmulateThirdButtonMoveThreshold" "30"
So for example your file will look like:
Section "InputClass"
Identifier "calibration"
MatchProduct "stmpe-ts"
Option "Calibration" "3800 120 200 3900"
Option "SwapAxes" "1"
Option "EmulateThirdButton" "1"
Option "EmulateThirdButtonTimeout" "750"
Option "EmulateThirdButtonMoveThreshold" "30"
EndSection
This makes a right mouse click emulated when holding down the stylus for 750 ms.
Python Button Inputs with Blinka
If you would like to use the buttons on the TFT, Python is the easiest way to receive input . With Blinka, you can wait for input and run system processes or control other hardware. Since Python is such a flexible language, you can add some effects such as fading the backlight in or fading it out. First make sure you have Blinka installed. For the Raspberry Pi, you can follow our CircuitPython Libraries on Linux and Raspberry Pi guide. To receive input and display the button that was pressed, you can use this simple demo script:
import time import board from digitalio import DigitalInOut, Pull buttons = [] for pin in (board.D17, board.D22, board.D23, board.D27): button = DigitalInOut(pin) button.switch_to_input(pull = Pull.UP) buttons.append(button) while True: for i, button in enumerate(buttons): if not button.value: print(f"Button {i + 1} pressed") time.sleep(0.01)
Text editor powered by tinymce.