I want to make a small launcher image that is not resizable, movable and doesn't appear like another open window, for one of my python programs, but after a lot of searches, I still can't find how to do one.
Does someone know how to do this?
I want it a bit like this:
Related
I'm trying to find a way to keep a fixed line of text displaying at the top of the screen the entire time a Python script runs. Functionally, it would behave like the top line in nano editor; the program title remains at the top of the screen, even when scrolling through text in the editor area. The idea is that the line would contain the name of the script that's running, and perhaps some dynamic information (progress indicators), and remain visible even when text output beneath that line scrolls.
From what I've researched so far, the curses module could possibly provide the foundation for reaching that goal. I have yet to find a curses example that specifically demonstrates what I'm trying to accomplish, and the learning curve is a bit steep for me at the moment.
The scripts would run on a Linux box without a GUI.
Thanks!
If you want something simpler than curses, then look into using npyscreen.
This framework should be powerful enough to create everything from quick, simple programs to complex, multi-screen applications. It is designed to make doing the simple tasks very quick and to take much of the pain out of writing larger applications.
And it's built on curses.
I've been looking for a way to screenshot a window that is not on top. It's not minimized, just covered by another one which is active.
For instance, let's say I want to screenshot an online chat (window 1, not active, running in the background, not minimized) while watching a youtube video (window 2, active, showing on screen).
I'm pretty sure there are ways to do this, most of flash application keep rendering even when covered by another window.
Currently, I havn't found anything reliable.
I have been looking at C++ solutions and python ones (but I'd rather have a python one). A VBA one would be great too since I often work with macros.
I also though of creating a virtual dual screen, and assigning the window I want to screenshot to it, to have it rendering the window. But I don't know how and if it could work.
If you have any ideas, let me know :)
Thank you
I wanted to use Python to create animations (video) containing text and simple moving geometric objects (lines, rectangles, circles and so on).
In the book titled "Python 2.6 Graphics Cookbook" I found examples using Tkinter library. First, it looked like what I need. I was able to create simple animation but then I realized that in the end I want to have a file containing my animation (in gif or mp4 format). However, what I have, is an application with GUI running on my computer and showing me my animation.
Is there a simple way to save the animation that I see in my GUI in a file?
There is no simple way.
The question Programmatically generate video or animated GIF in Python? has answers related strictly to creating these files with python (ie: it doesn't mention tkinter).
The question How can I convert canvas content to an image? has answers related to saving the canvas as an image
You might be able to take the best answers from those two questions and combine them into a single program.
I've accomplished this before, but not in a particularly pretty way.
Tl;dr save your canvas as an image at each step of the iteration, use external tools to convert from image to gif
This won't require any external dependencies or new packages except having imagemagick already installed on your machine
Save the image
I assume that you're using a Tkinter canvas object. If you're posting actual images to the tk widgets, it will probably be much easier to save them; the tk canvas doesn't have a built-in save function except as postcript. Postscript might actually be fine for making the animation, but otherwise you can
Concurrently draw in PIL and save the PIL image https://www.daniweb.com/software-development/python/code/216929/saving-a-tkinter-canvas-drawing-python
Take a screenshot at every step, maybe using imagegrab http://effbot.org/imagingbook/imagegrab.htm
Converting the images to to an animation
Once the images are saved, I used imagemagick to dump them into either a gif, or into a mpg. You can run the command right from python using How to run imagemagick in the background from python or something similar. It also means that the process is implictely run on a separate thread, so it won't halt your program while it happens. You can query the file to find out when the process is done.
The command
convert ../location/*.ps -quality 100 ../location/animation.gif
should do the trick.
Quirks:
There are some small details, and the process isn't perfect. Imagemagick reads files in order, so you'll need to save the files so that alphabetical and chronological line up. Beware that the name
name9.ps
Is alphabetically greater than
name10.ps
From imagemagick's point of view.
If you don't have imagemagick, you can download it easily (its a super useful command-line tool to have) on linux and mac, and cygwin comes with it on windows. If you're worried about portability... well... PIL isn't standard either
There is a way of doing that, with the "recording screen method", this was explained in other question: "how can you record your screen in a gif?".
Click the link -->LICEcap : https://github.com/lepht/licecap
They say that it's free software for Mac (OS X) and Windows
You could look at Panda3D, but it could be a little over killed for what you need.
I would say you can use Blender3d too but i'm not really sure of how it works. Someone more experimented then me could tell you more about this.
Well i am creating a utility for my own needs, that being to help improve my reading on the computer. What i need to do is create a tool which can add a colour filter to a section of the screen, as well as add zoom. The first thing was easy to do, i set the attributes to add alpha, topmost and gave a frame a set bg colour.
What i dont know how to do is the zoom. I was thinking of getting a screen capture cut the selected bit apply image transformation then render it in the window. Of course the utility window will also be drawn and obscure the screen capture. I dont know tkinter well enough and i really want to avoid doing GDI work, but if someone has a solution with it i dont mind using it. Clearly referencing GDI, im making it to run on windows.
Optional: Something i have a work around for but would be nice to have is the ability to click through a window, but i doubt i can do that with tkinter.
EDIT: Since im getting negative votes, and i don't know why please help me improve with a comment.
I'm not looking for someone to do the work for me i just want a hint on what might be the right way to do this. With the main problem being how to get a image for whats underneath the Tkinter window so i can process it.
I am a new programmer with little experience but I am in the process of learning Python 2.7. I use Python(x,y) or Spydar as the programs are called on Windows 7.
The main packages I'm using are numpy, pil and potentially win32gui.
I am currently trying to write a program to mine information from a 3rd-party software. This is against their wishes and they have made it difficult. I'm using ImageGrab and then numpy to get some results. This however, or so i belive, forces me to keep the window I want to read in focus, which is not optimal.
I'm wondering if there is any way to hijack the whole window and redirect the output directly into a "virtual" copy, just so I can have it running in the background?
When looking at the demos for win32api, there is a script called desktopmanager. I never got it to work, probably since I'm running Windows 7, that's supposed to create new desktops. I don't really know how multiple desktops work but if they run in parallel, there may be a way to create a new desktop around a current window. I don't know how, it's just a thought so far.
The reason it's not working for me is not that it's not creating a new desktop, it's that once it's been created, I can't return from it. The taskbar icon nor the taskbar itself ever appears.
One approach that might work would be to do something like so:
get the window handle (FindWindow() or something similar, there are a few ways to do this)
get the window dimensions (GetClientRect() or GetWindowRect())
get the device context for the window (GetWindowDC())
get the image data from the window (BitBlt() or similar)
It is possible that you will need elevated privelages to access another processes window dc, if so you may need to inject code/dll into the target process space to do this.
HTH.