79636334

Date: 2025-05-24 01:10:21
Score: 0.5
Natty:
Report link

can i updte text on tkinter without interacting with the ui? (using as a display only)

Here is script:

import tkinter as tk
import RPi.GPIO as GPIO

# Setup GPIO
GPIO.setmode(GPIO.BCM)
button_pin = 18   
GPIO.setup(button_pin, GPIO.IN, pull_up_down=GPIO.PUD_UP)

def check_button():
    if GPIO.input(button_pin) == GPIO.LOW:  # Button pressed
        update_display()
    root.after(100, check_button)  # Check every 100 ms

def update_display():
    # Update your Tkinter display here
    label.config(text="Button Pressed!")

root = tk.Tk()
label = tk.Label(root, text="Waiting for button press...")
label.pack()

# Start checking for button presses
check_button()

root.mainloop()

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Starts with a question (0.5): can i
  • Low reputation (0.5):
Posted by: Adios Gringo