Create button to browse folders and select a file in python - python

I'm developing a python widget using tkinter where I need a button which will operate like any of the open button we see today. Basically I want it to help users to browse a file, select it and click ok. What i want is , as soon as the user clicks 'ok', it'll copy the file from that location and save it into a particular location in a particular name, which will be then used by rest of my widget.
Thanks in advance.

Take a look at the various widgets in tkFileDialog. They could be very useful. Particularly, you might want askopenfilename which will pop up a dialog where you can browse for a particular file -- When the user hits OK it returns a filename which you can do whatever you want with.

Related

PySimpleGUI: is there any way to create a new folder from FileSaveAs?

But I would like for the user, when using a "Save As" function, to also be able to create a new folder in which to put the file.
Is there any way to do this? I've looked through the call reference and the demo programs and don't see anything. FileSaveAs works beautifully for existing folders, but there doesn't seem to be any parameter to get it to make new folders.
Using the sg.SaveAs() chooser button in PySimpleGUI opens a "Save As" dialog box. It has specific options provided for the user to create folders that are not normally shown when browsing for a file to open.
If you wish to create them for the user, you can use os.mkdir prior to showing the dialog.

"Browse file" window freeze code execution in pywinauto

I am working on automating program that requires choosing file path.
After I click the browse button using code:
dlg.child_window(auto_id='btnBrwsBinFile').click()
browse window opens and freeze execution of code and I cannot control the popup window.
I have tried also different approach. I have edited text filed using code:
dlg['Edit'].set_text(path)
but then program do not see the path, it treats the field like it was never edited, like it was empty
I would like to ask if someone solved this issue before.
try:
dlg.child_window(title='btnBrwsBinFile').click_input()
pywinauto documentation:https://pywinauto.readthedocs.io/en/latest/code/pywinauto.findwindows.html
You can use UISpy.exe to get the title, class name

How to automatically take the data from MDTextfield without a button press in kivymd

Like I don't want the user to be pressing any button as placing the button will make the UI really ugly. And any other better alternatives will do the trick too.
so here there is no button when typing the stock/company name I want it to automatically alter results/by taking the string(from MDtextfield)
without the user having to press a ok/search button
there is another thing I am having a problem with ;
I want to further add google like auto-complete but from a pre-specified .txt file of strings of stock/company name/
This is something I am still working on there is not much i was able to find about this/

How to use checkable auto-exclusive buttons

I hope find an answer. I have created an application with Python and PyQt4, and I have made the buttons checkable to select a file or folder from the treeview, and all button are auto-exclusive. The problem is when I choose another tab and check a button from there, the button in the first tab is still checked and I can't call setchecked(False). Any idea how to solve this problem ?
archive with the code and the ui used : sorry i don't know how to insert the code here .
enter link description here

Place a Button in ListCtrl - wxPython

Is is possible to place a button inside of a ListCtrl item with wxPython? Right now I have a ListCtrl that has data with a file name and size, and I want the user to be able to click a button, to download the file. If this isn't possible, is there a way to display an image in the ListCtrl, and then make it clickable so that I can bind an action to it?
No. You will have to use "UltimateListControl", a generic list implementation that can attach any kind of widget to rows. Check its demo files for examples.
You're probably best off grabbing the trunk code for bugfixes and other changes - I'm not sure how often Andrea updates the main zip on his site
I've yet to use the control, but its demo is very impressive.

Categories