Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ Bug ] Problem with HID device at first fire in the edit focused in pysimplegui tkinter. #6728

Open
9 tasks
ingdariogiacomelli opened this issue Mar 26, 2024 · 8 comments
Labels
Platform Specific Issue - Android Specific to the Android environment. Port - TK PySimpleGUI PySimpleGUI 5 PySimpleGUI 5

Comments

@ingdariogiacomelli
Copy link

ingdariogiacomelli commented Mar 26, 2024

Bug

Problem with HID device at first fire in the edit focused in pysimplegui tkinter.

Operating System

Android

PySimpleGUI Port (tkinter, Qt, Wx, Web)

Tkinter


Versions

Version information can be obtained by calling sg.main_get_debug_data()
Or you can print each version shown in ()

Android 13 (the phone is samsung).
PSG is 5, i reinstall and i have inserted my developer key (take care, the screen is too much large in orizontal, it has been difficult to insert the passcode, but i set it).

Python version (sg.sys.version)

Pydroid ... i have not the cell in my hand now ... but seems thae pydroid has been update because running the pysimplegui app, library pusimplegui wasn't installed (they have been lost by pydroid). So is a recent pydrod i mean.

PySimpleGUI Version (sg.__version__)

5 with developer key inserted correctly

GUI Version (tkinter (sg.tclversion_detailed), PySide2, WxPython, Remi)

tkinter


Your Experience In Months or Years (optional)

6 Years Python programming experience

Since Commodore Vic 20 ... :-D ... Years Programming experience overall

Have used another Python GUI Framework? (tkinter, Qt, etc) (yes/no is fine)

No only the simpler tkinter

Anything else you think would be helpful?

I'm sorry is not simple to handle with warehouse workers ... it seems to me that the issue is due to some difference in recent android, with HID devices. Before, runned the psg app, it instantly fire barcode into che edit field. Now it's behaviour is changed, i do not know why, the app is the same. Some other phone has not this problem by i can't get now to see what android they have ...
If you can't give me some advice, I'll investigate further, but if in the meantime someone already had the solution to the problem... that's why I wrote.

Troubleshooting

These items may solve your problem. Please check those you've done by changing - [ ] to - [X]

  • 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
  • If not tkinter - looked for Demo Programs for specific port
  • For non tkinter - Looked at readme for your specific port if not PySimpleGUI (Qt, WX, Remi)
  • 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
  • [ x] Have upgraded to the latest release of PySimpleGUI on PyPI (lastest official version)
  • Tried running the Development Build. Your problem may have already been fixed but not released. Check Home Window for release notes and upgrading capability
  • For licensing questions please email license@PySimpleGUI.com

Detailed Description

Hi, I have a problem on an android cell where I run pydroid with pysimplegui. This is the second time this has happened to me, because it had already happened to me on another cell phone. So: the mobile phone is connected to a barcode reader. When I fire the barcode, and I'm in an edit field, clearly the read code was inserted immediately (the barcode is in keyboard emulation, connected via bluetooth). The barcode does not give any errors: if I run it into any text editor, it transcribes the barcode.
Now, I launch the program on Android and I see a pysimplegui window, with the cursor flashing inside an edit field, until recently it didn't cause problems. If I fired, it immediately inserted into the edit field. Now, however, if I shoot, nothing happens. Only if with my real finger I click inside the edit field and the Android virtual keyboard is shown, then from that moment on, by shooting in the reader the barcode is inserted into the edit. It therefore seems that the first time I launch the window, even though the edit field is in focus, Android doesn't feel that focus until I click in it with my finger. It's a problem because the warehouse workers don't understand what's happening, they hear the reader beeping, but they don't enter the code. Unfortunately, the warehouses often have staff who come and go and so it is problematic that even though the cursor flashing inside the edi field is there, when shooting it doesn't read anything... has anyone had the same problem? How can it be solved? I've tried various things at the android level, but I can't get past it. If you focus on an edit field, Android should feel like the edit field has been clicked, or not? Why didn't this happen a while ago? Maybe it's a problem on Android versions? cell phones are quite recent.

Code To Duplicate

A simple form with one edit field get the issue ... i think it is not necessary to paste code ...
Again, i will do more tests... but is not so easy o go to customers ....so if you can help me the same, i appreciate ... other wise, i will do more tests by miself ...

Screenshot, Sketch, or Drawing


Watcha Makin?

Well, I have done a 3D autoprinted case to contain 1) an android phone 2) and a HID barcode connected via bluetooth. With pydroid and PSG - what a powerful couple !! - , I now have the most powerful app to read barcode in the world ... i am joking, but the intergration with my ERP is fanatstic ... but i had this issue recently ... unfortunately warehouse workers are often a category of demanding users: either things work perfectly, or they don't use them at all...

@pysimpleissue pysimpleissue bot closed this as completed Mar 26, 2024
@PySimpleGUI PySimpleGUI changed the title [ Enhancement/Bug/Question] NOTE - you can also call sg.main() or sg.main_open_github_issue() to post an issue [ Bug ] Problem with HID device at first fire in the edit focused in pysimplegui tkinter. Mar 26, 2024
@pysimpleissue pysimpleissue bot removed Fill issue form or you will be REJECTED You MUST use the supplied template to submit a request. PySimpleGUI Issues Bot Has Detected an Error labels Mar 26, 2024
@pysimpleissue pysimpleissue bot reopened this Mar 26, 2024
Repository owner deleted a comment from pysimpleissue bot Mar 26, 2024
Repository owner deleted a comment from pysimpleissue bot Mar 26, 2024
Repository owner deleted a comment from ingdariogiacomelli Mar 27, 2024
Repository owner deleted a comment from ingdariogiacomelli Mar 27, 2024
@PySimpleGUI
Copy link
Owner

Android support has not been tested very well. We are also having some issues with focus on versions 8.65.12, 8.6.13 of tkinter (and likely more).

I have recently added to the popup_get_text this code to handle getting the focus in the right place:

    window.force_focus()
    window['-INPUT-'].set_focus()

You may need to do similar changes or experiment further.

Can you please get the versions involved with your setup, such as tkinter's version? You can use sg.main() as one place to find it. get_versions() Is another.

I've simply not had the availability to do much with Android and PSG5 yet. We're working on the license changes for PSG 5 as a whole and that's consuming much of my time. I'll work with you offline on this problem too. I didn't understand as much as now. It's still very helpful to post versions, etc, as well as what we learn here so others benefit.

@ingdariogiacomelli
Copy link
Author

my-palm

@ingdariogiacomelli
Copy link
Author

Thanks for help.
I'm here at the client's this morning, doing some tests. I'll make a simpler form with just one input, so I can test the problem easier than with the actual app I use.
If I figure something out myself, I'll let you know.
Dario
p.s. However, seeing the same programs running on your PC and PDA... is too overwhelming. On this occasion, congratulations indeed to PSG, it's frighteningly effective!

@ingdariogiacomelli
Copy link
Author

Ops, i have get another palm today ... i read is not pysimplegui5 ... but the problem is the same here (so is not PSGversion i think).

@ingdariogiacomelli
Copy link
Author

I am doing a video, please wait, i will post it ASAP.
Dario

@ingdariogiacomelli
Copy link
Author

@ingdariogiacomelli
Copy link
Author

Let me explain:

  1. the app has just started,
    and the focus is in the edit field
    (as you can see from the flashing cursor).

  2. shooting with the barcode (it's under the cell phone,
    recessed into the plastic case and connected
    via bluetooth to android), nothing happens.
    (while I assure you that until a few months ago,
    firing, he immediately entered the code).

  3. it starts working fine only when I click
    at least once with your finger. Then it's as if it activates
    something, and from that moment, despite the fact that it no longer touches the
    finger, if a field is in focus, the HID device feels
    and receives the barcode from it.

  4. in conclusion, I have to tell the warehouse worker to tap
    at least once with your finger a field, and visualize for a moment
    the android keyboard: after this the shot works,
    even without touching the edit fields.

  5. it seems silly, but it becomes problematic,
    everyone is used to the fact that if a field flashes, the barcodes immediately fire...

I hope I haven't messed up, I never use YouTube, I made a video and posted it, hoping it's visible to everyone.

@ingdariogiacomelli
Copy link
Author

Hi, for the moment I have done a simple workaround: I force the warehouse worker to click on an edit field, and then on a button. In the meantime the keyboard has been activated, and the handheld is ready to fire. And after that, he has no problems.
I tried with various things, on simple masks, but I didn't solve the problem of the first focus. For now I'll stop like this... it will be an Android update thing because months ago at the first focus it worked without problems.

https://www.youtube.com/shorts/3nM1DbAqGH0

@PySimpleGUI PySimpleGUI added Port - TK PySimpleGUI Platform Specific Issue - Android Specific to the Android environment. PySimpleGUI 5 PySimpleGUI 5 labels Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform Specific Issue - Android Specific to the Android environment. Port - TK PySimpleGUI PySimpleGUI 5 PySimpleGUI 5
Projects
None yet
Development

No branches or pull requests

2 participants