[issue40011] Tkinter widget events become tuples

2020-03-21 Thread Hênio Tierra Sampaio

Hênio Tierra Sampaio  added the comment:

Yes, you guys were right. I solved the problem by writing a new, simpler 
debugging class. I'm sorry for taking your time! Thank you!

--

___
Python tracker 
<https://bugs.python.org/issue40011>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40011] Tkinter widget events are of type Tuple

2020-03-18 Thread Hênio Tierra Sampaio

Hênio Tierra Sampaio  added the comment:

Sorry for the similar messages. The second one was to remove the paragraph 
stating that it would be possible to circumvent the problem of the Listbox - it 
is not.

--

___
Python tracker 
<https://bugs.python.org/issue40011>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40011] Tkinter widget events are of type Tuple

2020-03-18 Thread Hênio Tierra Sampaio

Hênio Tierra Sampaio  added the comment:

I'm maintainer for a project for the RaspberryPi, a GUI for OMXPlayer called 
TBOPlayer. This GUI was originally made for Python 2, but with Python 2 
deprecation, I decided to convert it to Python 3. After (supposedly) converting 
all of it I had a surprise to see that the events that worked in the original 
code with Python 2 didn't work anymore in Python 3 with errors like

File "/home/henio/Projetos/tboplayer/lib/tboplayer.py", line 1566, in 
select_track
sel = event.widget.curselection()
AttributeError: 'tuple' object has no attribute 'widget'


And upon investigation, I noticed all the widget events (originally of type 
tkinter.Event) were now of type Tuple. WTF. Ok, I tried to circumvent this by 
using the tuple "attributes", like, in the event

(('17685', '1', '??', '??', '??', '256', '59467466', '??', '212', '11', 
'??', '0', '??', '??', '.!listbox', '5', '1030', '344', '??'),)

I can access the x position of the cursor in relation to the widget by doing:

event[0][8]

Which I did. However, I obviously cannot use any of the Event methods, and this 
way I cannot get the current selection from a Listbox, for example, and trying 
to gives me the exact error mentioned above. This renders TBOPlayer useless as 
the user cannot even select a track for playing.

And unfortunately, I was unable to reproduce this issue with a minimum code, so 
I have no idea what's going on.

This issue comment describes how to reproduce the bug inside of TBOPlyaer: 
https://github.com/KenT2/tboplayer/issues/175#issuecomment-600861514

--

___
Python tracker 
<https://bugs.python.org/issue40011>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40011] Tkinter widget events are of type Tuple

2020-03-18 Thread Hênio Tierra Sampaio

Change by Hênio Tierra Sampaio :


--
title: Widget events are of type Tuple -> Tkinter widget events are of type 
Tuple

___
Python tracker 
<https://bugs.python.org/issue40011>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40011] Widget events are of type Tuple

2020-03-18 Thread Hênio Tierra Sampaio

New submission from Hênio Tierra Sampaio :

I'm maintainer for a project for the RaspberryPi, a GUI for OMXPlayer called 
TBOPlayer. This GUI was originally made for Python 2, but with Python 2 
deprecation, I decided to convert it to Python 3. After (supposedly) converting 
all of it I had a surprise to see that the events that worked in the original 
code with Python 2 didn't work anymore in Python 3 with errors like

File "/home/henio/Projetos/tboplayer/lib/tboplayer.py", line 1566, in 
select_track
sel = event.widget.curselection()
AttributeError: 'tuple' object has no attribute 'widget'


And upon investigation, I noticed all the widget events (originally of type 
tkinter.Event) were now of type Tuple. WTF. Ok, I tried to circumvent this by 
using the tuple "attributes", like, in the event

(('17685', '1', '??', '??', '??', '256', '59467466', '??', '212', '11', 
'??', '0', '??', '??', '.!listbox', '5', '1030', '344', '??'),)

I can access the x position of the cursor in relation to the widget by doing:

event[0][8]

Which I did. However, I obviously cannot use any of the Event methods, and this 
way I cannot get the current selection from a Listbox, for example, and trying 
to gives me the exact error mentioned above. This renders TBOPlayer useless as 
the user cannot even select a track for playing.

I could circumvent this specific problem by keeping track of the previous 
clicked position over the Listbox and do a simple math calculation to get the 
current list item, but that's is very annoying, and not the right way to do it, 
meaning it would make the code more complex than it should be, and making 
maintaing more difficult.

And unfortunately, I was unable to reproduce this issue with a minimum code, so 
I have no idea what's going on.

This issue comment describes how to reproduce the bug inside of TBOPlyaer: 
https://github.com/KenT2/tboplayer/issues/175#issuecomment-600861514

--
components: Tkinter
files: tboplayer.py
hgrepos: 387
messages: 364586
nosy: Hênio Tierra Sampaio
priority: normal
severity: normal
status: open
title: Widget events are of type Tuple
type: crash
versions: Python 3.7
Added file: https://bugs.python.org/file48982/tboplayer.py

___
Python tracker 
<https://bugs.python.org/issue40011>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com