Question: Python - Tkinter - Save toplevel window as Image/PDF/Word
2
gravatar for st.ph.n
8 weeks ago by
st.ph.n1.2k
Philadelphia, PA
st.ph.n1.2k wrote:

I'm going to preface this question, that I asked it on SO, but did not receive an answer.

I have a GUI that takes a FASTA file and makes a multi-sequence alignment, and highlights in red some amino acids in the alignment, and prints them to a toplevel window. The alignment is exactly what I want, but is there a way to save this window as a image, PDF, or Word document in order to maintain the colors? Others will be using the GUI, so 'Print Screen' is less than ideal.

tkinter python image • 179 views
ADD COMMENTlink modified 8 weeks ago by phdresearchproposal.org0 • written 8 weeks ago by st.ph.n1.2k

Thanks for the pyscreenshot program. I also work on Linux =)

ADD REPLYlink written 8 weeks ago by phdresearchproposal.org0

Please use ADD COMMENT or ADD REPLY to answer to previous reactions, as such this thread remains logically structured and easy to follow. I have now moved your post but as you can see it's not optimal. Adding an answer should only be used for providing a solution to the question asked.

ADD REPLYlink written 8 weeks ago by WouterDeCoster20k

From what I gathered, pyscreenshot is a replacement for PIL which is used for windows.

ADD REPLYlink written 8 weeks ago by st.ph.n1.2k

PIL has also other applications when using Linux, just for general image processing.

ADD REPLYlink written 8 weeks ago by WouterDeCoster20k
2
gravatar for st.ph.n
8 weeks ago by
st.ph.n1.2k
Philadelphia, PA
st.ph.n1.2k wrote:

I was able to get the coordinates of the toplevel window, and height and width with the following command, then using pyscreenshot (note: using Linux for pyscreenshot), was able to save it as a jpeg.

import pyscreenshot as ImageGrab
alignment = Toplevel()
box = [alignment.winfo_x(), alignment.winfo_y(), alignment.winfo_width(), alignment.winfo_height()]
ImageGrab.grab(bbox=box).save("out_snapsave.jpg")
ADD COMMENTlink modified 8 weeks ago • written 8 weeks ago by st.ph.n1.2k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 587 users visited in the last hour