jarvisteach / appJar

Simple Tkinter GUIs in Python
http://appJar.info
Other
615 stars 68 forks source link

Reading a usb hand scanner input into a text area #581

Closed Petra-Kate closed 5 years ago

Petra-Kate commented 5 years ago

Bug Report

Information scanned via a USB DataLogic hand scanner (which works well on command line or as text input into a simple editor) does not appear in a TextArea input if this input field is only a single line one (setTextAreaHeight("...", 1).

Context

I need to read in a qr code or a bar code supplied by a DataLogic hand scanner. The scanner delivers simple ASCII Text, combined with a \n at the end.

Expected Behaviour

If focus is on a single-line TextArea in a dialog box, scanning the code should deliver read characters in the box and ignore the trailing LF.

Actual Behaviour

No Characters appear at all in the dialog field. If AreaHeight is set to 2, input is shown. Evaluation of the read-in text needs to use app.getTextArea("...")[0]

Any error messages produced by appJar

No error messages

Sample code, demonstrating the issue

No code, as dialog box works essentially.

What steps are needed to reproduce the bug

Set height to 1 and scan with hand scanner.

Version Information

appJar: 0.83.0, Python: 3.4.2, TCL: 8.6, TK: 8.6, Platform: Linux (Raspberry Pi Jessie); locale: de_DE

jarvisteach commented 5 years ago

Hi @Petra-Kate - I've tried to replicate this by pasting text into the text area which includes a new line character. It does look like the text hasn't;t been pasted, but actually it's there, but showing me the blank new line - if I scroll up, or enlarge the window, the text has been entered.

I think this makes sense - the text area is configured to always show the last text entered - in this case a new line, and as it's only 1 line...

Have you thought about using an "input" instead?

Petra-Kate commented 5 years ago

Hi Richard,

Hi @Petra-Kate https://github.com/Petra-Kate - I've tried to replicate this by pasting text into the text area which includes a new line character. It does look like the text hasn't;t been pasted, but actually it's there, but showing me the blank new line - if I scroll up, or enlarge the window, the text has been entered.

I think this makes sense - the text area is configured to always show the last text entered - in this case a new line, and as it's only 1 line...

Yes, you are right. But I would expect the input area box to give an indication that there are additional lines, like a scroll bar. This holds as well for larger TextArea boxes. I just checked with my modified two line input box, and it doesn't show scroll bars as well if I input more than one scan.

Have you thought about using an "input" instead?

You mean the basic input from pure python? I sanity checked the reading with it before contacting you. I want to keep the input systematic as streamlined as possible, with the input possible either by scan or by keyboard, and integrated into the respective GUI dialog. Therefore: rather no fundamentalistic scanner input. :-)

Kind regards,

Petra

-- g.o.e.the LinguAdapt Dr. Petra Roosen U. Vollmer & Dr. P. Roosen GbR http://www.goethe-ac.de http://www.linguadapt.de Tel. ++49 241 7091525 Tel. ++49 241 7091520

Aphasie- und Anopsietherapiesysteme: http://www.linguadapt.de Vergleichen Sie Ihre Firma: http://filius.vorostat.de Energietechnische Kostenfunktionen: http://kfserver.kaiserstadt.de E-xx Kraftstoffe in Flugzeugen: http://vorostat.de/s/ExRep.html Strukturanalyse interdisziplinär: http://vorostat.de/s/Struct.html

jarvisteach commented 5 years ago

Sorry, I meant to say: have you tried the entry widget for single line input.

We have implemented a scrollable textArea, which does have scroll bars, but having played with that on my mac - it doesn't really work for a single line text area, as the handle in the scrollbar is too big!

app.addScrolledTextArea('s')
app.setTextAreaHeight('s', 1)
Petra-Kate commented 5 years ago

Hello Richard,

We have implemented a scrollable textArea http://appjar.info/inputWidgets/#add-textareas, which does have scroll bars, but having played with that on my mac - it doesn't really work for a single line text area, as the handle in the scrollbar is too big!

:-)

Sorry that I obviously overlooked the addScrolledTextArea(), which is indeed exactly what I was looking for. I guess the best approach for me is indeed to make the area two lines high, and evaluate just the first line that is read from the area.

Kind regards and thanks for the timely responses!

Petra

-- g.o.e.the LinguAdapt Dr. Petra Roosen U. Vollmer & Dr. P. Roosen GbR http://www.goethe-ac.de http://www.linguadapt.de Tel. ++49 241 7091525 Tel. ++49 241 7091520

Aphasie- und Anopsietherapiesysteme: http://www.linguadapt.de Vergleichen Sie Ihre Firma: http://filius.vorostat.de Energietechnische Kostenfunktionen: http://kfserver.kaiserstadt.de E-xx Kraftstoffe in Flugzeugen: http://vorostat.de/s/ExRep.html Strukturanalyse interdisziplinär: http://vorostat.de/s/Struct.html