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.
Related
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
I have a word document from a colleague who gave me a .docx Microsoft Word file with 90 images on it that need to be extracted so they can be turned into flashcards. I tried using the Python module "docx2txt" which worked ok, but only extracted 34 images. Upon further inspection, I found that it was because when my coworker made the original file, he took screenshots of PowerPoint slides that he had made with about 4-6 of the images on one slide. Then, he would put them in Word and use the built in Word trimming tool to copy the picture several times and trim down to each individual picture he needed in a particular line of the document. Docx2txt copied the pictures files to my designated directly perfectly, but did not keep the formatting. Any picture file he had inserted and "trimmed down" to size, was copied as the full image. Does anyone know of a way to keep the formatting so I don't have to go through and manually copy 90 pictures one by one? Perhaps converting to a .pdf file and using a pdf related module or something? Or might be there some way of using another Python library which will keep the picture formatting? Thanks for any help you can provide! I'm somewhat of a beginner with Python, but love it when I can get it to automate stuff... even if it ends up taking longer to figure out how to do it than just boring myself to death saving the photos manually, lol.
https://support.microsoft.com/en-us/topic/reduce-the-file-size-of-a-picture-in-microsoft-office-8db7211c-d958-457c-babd-194109eb9535
Important: Cropped parts of the picture are not removed from the file, and can potentially be seen by others; including search engines if the cropped image is posted online. Only the Office desktop apps have the ability to remove cropped areas from the underlying image file.
Follow the relevant section for Desktop Office (Windows or Mac) note from above it CANNOT work on Web 365.
go to "Other kinds of cropping"
Important: If you delete cropped areas and later change your mind, you can click the Undo Button Image button to restore them. Deletions can [ONLY] be undone until the file is saved.
So make a backup copy of the file
Select the picture or pictures (If you want all selected that should be easy with CTRL + A to highlight everything)
Then follow the instructions
Picture Tools > Format, and in the Adjust group, click Compress Pictures
Be sure that the Delete cropped areas of pictures check box is selected
DEselect the Apply only to this picture check box.
Double check a few manually to verify all is well then save a copy.
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
I have a parent file type that is folderish, and I would like to include a thumbnail of the first page of a child pdf in the template. Can someone roughly outline the tools and process you can imagine would achieve this, so that I can investigate further?
Getting out the first page of pdf can be achieved by using ghostscript.
This is an example script which forms an gostscript command and stores the images. I took this from collective.pdfpeek. Which by the way could solve your problem right away :-)
Until few days ago I would have recommended you not to use it, since it was a little bit buggy, but they recently shipped a new version, so give it a try! I'm not sure whether they now support DX or not.
So the workflow for you should be.
Uploading a PDF
Subscribe modified/creation events.
create image of first page using ghostscript (check my command, or collective.pdfpeek)
store it as blob (NamedBlobImage) on your uploaded pdf.
Also implement some queueing like collective.pdfpeek to not block all your threads with ghostscript commands.
OR
Give collective.pdfpeek a shot!
BTW:
imho on a large scale the preview generation for pdfs needs to be implemented as a service, which stores/manages the images for you.
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.