In a console application, I need to take in credentials. I do it using lineEdit.text() and then clear it. In case I need to edit it, I want to bring back the text on the lineEdit space. How do I do that? Didn't figure out much from the documentation.
Related
I want to create a suggestions system for a console I'm embedding into my interface, but there's one feature I want to add that I don't see how to. My inspiration is how minecraft consoles work:
As you can see, the autocomplete tries to fill up the rest of the lineEdit based on what the first suggestion in the input is. I assume that this behaviour could be replicated using the placeholder text system we have now, but I don't really see how to make the placeholder show when there's text written. Any ideas?
I am currently developing an automated test case which performs actions on a console application (very simple, just clicking buttons and inputting text).
I have been able to successfully click through the application and input data without many problems, which includes identifying elements and things like that.
I have not been able to verify the existence of GUI elements that aren't clickable, ie an image that is loaded into the console application. I have tried looking through the output when using print_control_identifiers() for any indication of where data about an image in the window might be stored. I have tried looking at the tree diagram of the windows before and after loading the image in to see if it changes (it does not).
I have also then looked into verifying basic things, like font type or other properties that exist in the VS development platform, without success. To do this I used handleprops.font among other things. I have also read through the handleprops class and tried to find anything in there that I can use, but none of it is working.
My question is: is there a way to access an image's information that is stored in the window? I am able to identify where it is stored (picturebox1) and get information about that window (handleprops.rectangle) but cannot get anything about whether the image is there (like a path to image for example). All I can access is 'controllable' items, those that show up in print_control_identifiers()
I'm not sure this is possible with pywinauto but I have been stuck on this for a while and wondered if there were any suggestions people had.
Thanks
I want to create a simple Python app which would interact with currently selected text and do some things with it when user presses a keyboard shortcut. The obvious way to do this would be to copy the text to clipboard using pyautogui.hotkey("ctrl", "c") and then interact with it. Problem is, this method overwrites whatever the user currently has in their clipboard.
The only workaround I've been able to think of would be something like:
#make a backup of current clipboard contents
tmpClipboard = pyperclip.paste()
#copy selected text and store it
pyautogui.hotkey("ctrl", "c")
selectedText = pyperclip.paste()
#copy old clipboard contents back inside
pyperclip.copy(tmpClipboard)
#process selected text
doStuff(selectedText)
What would be a better way of handling this (as I'm not sure how well this would perform when user has, say, an image in their clipboard instead of plain text)?
You can try to let the user define hotkey for interactions. I do not know your end application, therefore it depends on the user experience you want to achieve. If the user is an engineer, for example, I think he would prefer to be prompted about the default hotkey, and change it if he wants.
Regarding grabbing the selected text - it depends on your GUI binding - are you using Tk, Qt, etc..?
For instance, Qt has a QTextCursor that you can use to obtain information about the cursor and user selection, and then grab the text without using the whole clipboard trick. This way you can also be sure you get the data you desire.
As for images, etc: if you still choose to go with clipboard, you can assert the type of data. However, it has really vast amount of possible values and it seems to be very cumbersome and inefficient.
Good luck!
I am working on a small project using PyQt5 (Python 3) and I want a widget where a user can select/modify a file, somewhat akin to the left-hand side of file explorer on Windows:
This cannot be done with QFileDialog as I want to display files that are not on the user's drive.
I have tried writing my own, however I am a beginner and I lack the skills to do it correctly (hence the reason why I'm trying to learn). I can provide the code if that would be useful.
Is there such a thing built in to pyqt? Has anyone created one before, with source code available?
Thanks in advance.
EDIT: More specifically I don't want a way to access remote files, just a widget that displays entries (along with icons, preferably) and subentries in a sort of drop-down menu, like the section of file explorer mentioned above. It doesn't necessarily have to be to do with files, consider it a drop-down menu if that helps.
I know this is old but for anyone looking for an answer it's the QTreeView widget.
I have a QTreeWidget that contains rows of data for multiple students. When double clicking on a row, a window opens, with a number of drop down menus and text edits that a user can input into. Currently, the user can open the file menu in the top left corner of that window and save the file manually in a folder from there and also open it, but this is inefficient for my program, and I want to make it so that each individual student in the QTreeWidget will have their own individual window open up, that, when a save button is pressed in the window, the data within the window will save within a database of some sort, and when that student's window is opened again, the information inputted specifically in the window and saved earlier for that student will load up automatically.
The QTreeWidget looks something like this (ignore the issue with the scroll bar in the corner. Names have been censored for data protection):
QTreeWidget
And the window containing user inputted data looks like so:
Popup Window
If there are any documentations or tutorials that could help me with this issue, I'd love to know, because I can't seem to find anything related to this anywhere. Even any basic ideas on how I could go about introducing this function into my program would be of great help. I am using Python 3.4 and MySql.
Why don't you start with studying how the standard MVC is implemented in Qt?
The following resources should be a good start for you:
this intro site
or this video series