Hide bottom HTML/widget, and remove Drag & Drop from Streamlit file_uploader() - python

I´ve created an app using Streamlit, which needs to read multiple files at once. I´m using the file_uploader() component with the parameter accept_multiple_files=True.
I got 2 questions:
First is if there´s a way to hide the bottom HTML/Widget that appears after uploading a file/s (see picture below)?
And second, if there´s a way to remove the drag&drop option, just leaving "Browse Files" toggle button?

The best solution currently is using the st.beta_expander() to hide the st.file_uploader() without having to programmatically play with the rerunning script to see if files were added. So for example in my problem it would be something like:
with st.beta_expander("Upload DICOM Files"):
uploaded_files = st.file_uploader("Select DICOM Files:",
accept_multiple_files=True,
type='dcm')
More info about the st.beta_expander() and what can be done with it here.

Related

How to put excel window upfront in xlwings?

How can I put excel window in front of other apps in terms of visibility? I am not interested in making it visible in visible=True attribute of App, because I can only see the excel window in taskbar. I need to see it in front of me (on top of other apps), so I can use pyautogui.
app = xw.App(add_book=False)
api_wb = app.books.api.Open(file_directory, UpdateLinks=False)
wb = xw.Book(impl=xw._xlwindows.Book(xl=api_wb))
A sample of the code is here. Although any other method of opening file will result in the same excel being wrapped to taskbar.
How can I solve this?
I also wanted to upload an image of the issue, but stackoverflow didn't let me saying: 'An error occurred when uploading the image: Service Unavailable'. The image format is .png
You need to activate the app and steal the focus like this:
app.activate(steal_focus=True)
see: https://docs.xlwings.org/en/stable/api.html#xlwings.App.activate

Verify presence of GUI elements in console application

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

Is there a PyQt5 widget for drop-down "file explorer" menu?

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.

pptx-python - Powerpoint always opens on master slide page

I have an app that creates powerpoints. Everything goes well except that every time I want to open one of these powerpoints it opens it in the slide master view. This isn't necessarily a problem per se, but just annoying since I open a lot of these powerpoint files. Has anyone else encountered this? Any idea what this is due to?
This happens on both mac and windows.
I create a presentation from a template, generate the slides and then save it more or less like this:
self.prs = Presentation(
self.template_path)
for c, slide in enumerate(self.data):
self.generate_slide(slide)
self.prs.save(save_location)
I had this issue before, it was because the template slide was saved in the slide master view same as what Johnathon said.

Export first frame from a GIF to PNG

I thought you maybe could help me out here :-)
So I just launched my website, where I will upload some GIFs and have them displayed on the front page.
As of right now, I use a script to show a .png file, when a mouse is hovered, the .gif shows and you can click on it, which will link you to the .gif file.
So right now I got two files for every GIF; xxx.gif and xxx_thumb.png -- however, I would like this to get automatized and thought of a simple script.
In pseudo code:
get .gif
rename to 1.gif
if 1.gif taken? rename to 2.gif
get first frame
export first frame as 1_thumb.png
if 1_thumb.png taken? rename to 2_thumb.png
load new picture? (y/n)
if n
exit
if y
start from step 1
Something like this would be awesome -- how hard would it be to code? Would Ruby or Python do the job?
Would this be possible with a web app, then send the .gif + .png as an email to me? <-- not necessary yet :-)
Thanks for reading this!
For Ruby you could check out rmagick and while this is for an older version of Rails it starts the process you would follow.

Categories

Resources