Skip to content

[Question] Options for creating a dynamic, clickable set of elements (image, text, etc.) #6895

Description

@NormPlum

Type of Issue (Enhancement, Error, Bug, Question)

Question


Operating System

Linux Mint 22

PySimpleGUI Port (tkinter, Qt, Wx, Web)

tkinter


Versions

Python Interpeter: ~/[PROJECT]/.venv/bin/python3
Python version: 3.12.3
Platform: Linux
Platform version: ('glibc', '2.39')
Port: PySimpleGUI
tkinter version: 8.6.14
PySimpleGUI version: 6.2
PySimpleGUI filename: ~/[PROJECT]/.venv/lib/python3.12/site-packages/PySimpleGUI/PySimpleGUI.py


Troubleshooting

  • Searched main docs for your problem PySimpleGUI Documenation
  • Looked for Demo Programs that are similar to your goal. It is recommend you use the Demo Browser! Demo Programs
  • None of your GUI code was generated by an AI algorithm like GPT
  • Run your program outside of your debugger (from a command line)
  • Searched through Issues (open and closed) to see if already reported Issues.PySimpleGUI.com
  • Upgraded to the latest release of PySimpleGUI on PyPI (Version 6)

Detailed Description

I'd like to create clickable sets of elements, that is, an image and some text elements. I'd like to be able to click on any part of that set of elements (the image, the text, or anywhere in between them) and run some code when that happens. These sets of elements need to be dynamic, in that they will be added/removed based on user input.

What I've tried:

  • A Column with the various elements inside it
    I don't know how to make the whole column clickable though...
  • A Table
    Rows are clickable, but apparently you cannot add images to a table...
  • A Tree
    You can add images, but you cannot resize them (like with an sg.Image element)

So what's the best solution here? Am I missing anything?

Screenshot, Sketch, or Drawing

Image

This is what I have currently when using Columns (enter a search term and a list of results are displayed). I want the green box to be clickable.


Watcha Makin?

An app that essentially lets me edit JSON files for a static website - it'll read in a JSON file of YouTube videos and display them on the left. On the right is what I'm building now - the ability to search for a movie or TV series and copy it's TMDB ID to paste into the video's JSON data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Port - TKPySimpleGUIQuestionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions