1

I'm developing an python3 application that only uses a handheld scanner for input. I need to prompt the user for input and want to use a nice window to do it. When I look at tkinter, it appears that you need to have a mouse to close the window to click on the "X" or on a button.

Or is there another option outside of tkinter

1 Answer 1

0

Note: this answer assumes you are using a barcode scanner, although it could be an image scanner. Unfortunately, the question is unclear.

Tkinter seems to be the best option, as you can use use this code:

self.root.destroy()

to close the window. When run, the Tkinter windows will be closed without requiring mouse input. Also, you can just run the code you want to execute (with the button) when the scanner is interaced with using keypress detection in python. Most barcode scanners are detected as keyboards and most come with an 'enter' barcode in the manual that sends a keypress of the enter key to the system.

2
  • Please forgive me, but i'm a newbie at this interface development. Yes, I'm using a barcode scanner. I'm not sure to intertwine them to work together. The little bit of work I have done with pygame generates it own window that needs focus to capture the key presses. So, I'm not sure if I'm doing this correctly or using the correct tool for it.
    – Ron Draper
    May 6, 2018 at 16:09
  • What model of barcode scanner are you using? Some are in serial mode by default, which means that they need drivers to use or a specific python library. Others are keyboard ones that just input the barcode as text. May 7, 2018 at 10:55

Not the answer you're looking for? Browse other questions tagged or ask your own question.