0

I am writing Python code for a 10.1 inch touchscreen to display. I am using PiSimpleGUI for the interface. When I use popup windows, I am not able to click on the "ok" or "cancel" buttons on the popup with my finger, however if I use a mouse it works. In the normal windows, I can click on regular buttons to carry out my functions with my finger, but why wont it let me click the popup windows? I provide a snippet of code below to show the popup windows I am referring to.

        elif event == '-FINISH-':
            if self.selected_button:
                # Construct the message using f-string
                message = f' You Selected:          \n Hardware: {self.selected_button}\n Quantity: {values["-QUANTITY-"]}'
                # Display the popup
                popup_result = sg.popup_yes_no(message, title="", font=('Helvetica', 14), keep_on_top=True)
                if popup_result == 'Yes':
                    # Add selected hardware and quantity to the shopping list
                    hardware = self.selected_button
                    quantity = int(values['-QUANTITY-'])
                    self.add_to_shopping_list(hardware, quantity)
                    # Display the shopping list popup
                    shopping_action = self.handle_shopping_list()
                    if shopping_action == 'submit_order':
                        return State.DISPENSE_LOADING_SCREEN  # Transition to dispense loading screen
                    # Reset selected button and quantity slider
                    self.window[self.selected_button].update(button_color=('black', '#598baf'))
                    self.selected_button = None
                    self.window['-QUANTITY-'].update(5)  # Move the slider back to 5
            else:
                sg.popup_ok("Please Select Hardware Before Finishing", title="Alert", font=('Helvetica', 14),
                            keep_on_top=True)

I have tried everything I can think of.

1 Answer 1

0

I don't have a touchscreen like yours to do the test.

Better to post your configuration, like

  • What machine
  • OS
  • python version sys.version
  • PySimpleGUI Version sg.__version__
  • tkinter version sg.tclversion_detailed
  • What touchscreen

Try short, simple and executable script to demo your issue.

Example code

import PySimpleGUI as sg

sg.set_options(font=("Courier New", 20))
window = sg.Window("Title", [[sg.Button("POPUP", expand_x=True)]])

while True:

    event, values = window.read()

    if event == sg.WIN_CLOSED:
        break

    elif event == "POPUP":
        sg.popup_yes_no("Touch Screen", keep_on_top=True)

window.close()

Then tell us again about how it is now.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.