I'm trying to use two barcode scanners, but each needs to insert data into its own tkinter entry widget. Scanners can sometimes scan at the same time, so it's important that data is inserted in correctly widget. Both scanners will read similar data, 12 digits, so you can't tell it apart by content. Is it possible to assign scanners to entry widget somehow via USB port? Maybe there is some library that can help me to do something like this?
I already tried to use the HID library but I couldn't get anything basically, EVDEV is out because I'm on windows. Are there other possibilities? Someone can help me get this effect using HID or any diffrent way?
Related
I am trying to store the currently selected text in a variable. I am using the keyboard library to write text and execute certain key combinations. I am using the command 'keyboard.press_and_release('ctrl+a')' to select the current text, and my goal is to store that selected text in a variable named 'text'. This applies to any textbox, in any window whatsoever.
Any assistance in achieving this would be greatly appreciated.
I have attempted to use both pyautogui and pyperclip, however, neither have been successful. I considered alternative methods such as utilizing an external GUI to capture each keystroke and input, however, this approach is incredibly slow and inefficient.
I'm using pywinauto to interact with the window of an old game - specifically the dedicated server GUI. I've been able to connect to it with:
app = Application(backend="uia").connect(path=r"C:\Program Files (x86)\___.exe")
Using a loop, I'm able to read each line in a Listbox in a specific window using:
for i in dlg.ListBox.descendants():
print (i.window_text())
The Listbox behaves as like a console output area and I've also been able to write commands to the Edit (input) field which appear in the Listbox.
All of this is great considering I didn't think it would be easy at all!
However, the last part of what I'd like to do is proving more difficult...
I want to listen for changes in the list box so I can react to them and write different responses back into the Listbox. So for example, when a player joins the server, I want my code to know that a new line has appeared in the Listbox (so I can write a custom welcome message to the Edit field).
I have tried to look at listener scripts but I feel a bit out of my depth and can't seem to find a simple code example that could help me accomplish this. Does anyone have any ideas where I could look or what I could use?
Even better... would anyone be able to provide some sample code for me to re-work?
Is it possible to mount more than one image AND text on a Tkinter button?
Or, is it possible to put a FRAME containing images + text on a button?
I want a big button containing multiple widgets that, when taken together, fully describe the option the user will be able to choose.
I appreciate any suggestions!!
Is it possible to mount more than one image AND text on a Tkinter button?
Strictly speaking, no, it is not possible.
Or, is it possible to put a FRAME containing images + text on a button?
Yes, though it probably won't work on OSX. It would probably take you less time to actually try it than to type in the question on stackoverflow. A little research goes a long way.
You can also simply not use a button. Just use a frame or canvas, and set up bindings on the container and/or it's contents to react to a button click.
I would like to begin by thanking you all for taking time to try and help me out. For my dissertation project I have decided to make a network topology program (similar to somthing like Cisco packet tracer or GNS3) My program also has the added benifit of a subnet calculator. I have the basic layout complete and I feel rather confident that I will definitly complete this program, but due to a lack of information on the web regarding wxPythons drag and drop feature, I cant find anything which is specific to what I need.
What I would like is a column, or some sort of area within my frame that the user is able to select things like routers, switchs, servers, IP phones and hosts etc etc. They then have the ability to drag these network items from the column onto the topology area. They should then be able to double click the item and a new form pop up. the user can then give the item an ip address etc etc.
Please do not think I am asking for someone todo this for me, I am simply wondering if someone could help me out by suggesting wxPython tools that could suit the needs that I have stated. If anyone has had experience with this kind of thing then please could you shed some light on it for me. I would be more than happy to produce my code online if you should need to see it.
Thank you in advance for your time.
There are Drag and Drop examples in the wxPython demo. Also see http://wiki.wxpython.org/DragAndDrop or http://zetcode.com/wxpython/draganddrop/
Depending on how you're displaying your information in the topology area will decide how to make double-click function. For the most part, you either bind to the widget's double-click event or it's selection event and act accordingly in its handler to display the dialog or frame. When you can tell us what widget we're double-clicking on is when we'll be better able to answer that question.
My problem is: when I click an option in a Listbox, I want a third party Text [area] to be updated with information based on the Listboxs selection. As far as I can tell though I can't see a way to harvest that event. I come from java and am used to registering listeners and the like, is there a way to do something similar here?
use <<ListboxSelect>>:
http://farmdev.com/src/secrets/decorator/tkinter/step3.html