InputBox doesn't hadle paste action correctly

Bug #1752820 reported by Allan Chain
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Simple Game Code
Triaged
High
Sam Bull

Bug Description

I have copied letter'e' from elsewhere.When I pressed C-v , some number appeared,not the letter.
And i found this in sgc/widget/_interface/text.py:

text = [str(char) for char in text]

this probably doesn't run well,it returns a list of numbers.
BTW,on Windows,there're '\x00' in clipboard text sometimes,which pygame can't render properly.
Hope this can be fixed as well.

Tags: inputbox
Revision history for this message
Sam Bull (dreamsorcerer) wrote :

I don't seem to be able to paste from another app at all in Pygame (on Linux), so I guess that's not been properly tested.

Where is that line of code? I can't find it in the mentioned file...

Maybe also check if it's not something wrong with Pygame. Copy something from another app first, then run:

    print(pygame.scrap.get(SCRAP_TEXT))

It should output what you copied. If not, register a bug against Pygame.

Revision history for this message
Sam Bull (dreamsorcerer) wrote :

Ah, I figured it out. You're looking at the py3 version, which wasn't written by me.

So, at first look, if you change that line to:

    text = list(text.decode())

That should then work. I'll make sure the py3 version is updated and working for the next release (whenever I get around to working on it again).

Changed in simplegc:
status: New → Triaged
milestone: none → 0.4
assignee: nobody → Sam Bull (dreamsorcerer)
importance: Undecided → High
Revision history for this message
Allan Chain (allanchain) wrote :

print(pygame.scrap.get(SCRAP_TEXT)) works fine on windows.
thanks

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.