Is there maybe a library in python 3.x.x to get outside information like the color at a specific pixel not in python but for example in the browser or in a game? I want to experiment with python being in the background and distinguishing things happening on my current opened window or fullscreen application. I would highly appriciate a simple example.
Related
I'm starting with tkinter with Python3 and I found some issues in Ubuntu practising with the exercises when coming to icons.
I'm reading Mark Lutz's "Programming Python" and he uses a ".ico" file, but it does not work in Ubuntu. I got curious and started to search on the web, and it seems that few icon formats work (.xbm) in Ubuntu, less in color mode.
I was googling and also found that using PIL or pillow is useful for managing and using color icons in tkinter applications and GUIs, but I didn't found yet any piece of code or detailed explanation on how to use an ".ico" file for an icon in a tkinter GUI in a portable way.
I find pretty weird as well not finding some reusable piece of code or library/module which takes a graphics file and returns some kind of usable icon object ready for being used.
Any reccomendation? Am I searching badly?
I suppose a good alternative is having some software to convert formats, but I would prefer the best code-oriented solution with multiplatform applications in mind and as many supported formats as possible.
Edit: For making this clear, when I talk about icons, I'm referring to icons, those little images in the top-left corner of our windows or in the OS bar when minimized. This isn't about any other kind of image in labels, buttons or other widgets (I don't even think that should be called an icon)
Thanks in advance
I wish to use python to place an image (say jpg or bmp) at a specific location on my Windows 7 desktop. I would also like the ability to drag it around using the mouse and for the python code to store it's final locations coordinates. So when Windows restarts (with the python code configured to run at startup), it reads the stored location and places the image back at its previous location.
Is this possible to do?
If it is, could someone please provide some suggestions on how to do it, as my python experience is pretty limited?
Thanks.
You need to use LVM_SETITEMPOSITION for arranging icons on the desktop.
There are a similar questions:
How can I programmatically manipulate Windows desktop icon
locations?
win32 programming
Python is not the best choice for this job, but if it's required try to look in to - commctrl, win32gui, and pywin32 libraries
I googled and search stackoverflow before asking this question
Answers that I don't expect:
wxWidgets is the best Python GUIUse TkInter (BIM) for GUI development.
Q. How to make a GUI without using any module/library? i.e make a GUI from scratch. Modules like tkinter not allowed.
I've made several GUIs from scratch using SDL which is a low level drawing library. The advantage of doing that is that it will look exactly the same on any platform down to the pixel and you can get it to work on embedded systems. Full screen GUIs are really easy too. Disadvantages are that it is a lot of work.
In python the pygame library wraps SDL so you would use that, and in fact that is how I made the GUI for a lab instrument which had a large colour LCD screen. The controller ran linux, but not X-windows.
pygame is an extra library, yes, but I can't think of a way of making a GUI with only what python provides.
The easiest GUI to make without "module/library" is a web-based one. I.e. generate HTML with Javascript from your Python code, and let the Javascript interact via AJAX with your Python app. This can be implemented without too much effort with just the standard Python library (and some JS code, of course), or with modules that don't require "heavy" installation of platform-specific extensions.
I'm developing an application with PyGTK that will make use of visual-python's 3d drawings and animations, but I can't get both libraries to work together: they either hung up when I close the Gtk window or they get stuck when I run the application.
I've tried with threads and they run side-by-side, but when I close visual-python's window this kills python's interpreter, raising a Segmentation Fault.
Has anyone been able to use visual-python from a PyGtk app?
This is a non-trivial problem given the way that VPython wants to work, but there is an example in the contributed programs section of the VPython web site that shows how to embed VPython into a wxPython application, so perhaps you can look over that code and determine what you would need to do to perform the same magic in PyGTK.
Any ideas how I can display an image file (bmp or png) centered on the screen as an application splash screen when running a Windows console script based on a batch file, vbscript/wscript or Python console script?
I'm not interested in a wxPython solution - that's too much overhead just to implement a cosmetic feature like a splash screen.
Thank you,
Malcolm
A low-tech, ugly approach? How about opening an image viewer with the bitmap and killing it after some time or when the initializations are done? ;-)
You certainly have no native way of doing this in a batch file. From VBScript you could use an HTA. PowerShell has no problems of doing this with Windows Forms but wasn't on your list, though.
You can surely cook it up using the Win32 API and the win32api Python module.
How about this recipe? Alternatively, this article has some C code that can be converted for invocation from Python with win32api.
Try TK, it is included with python. Also, PyGtk is lighter than wxPython, but I ended up bitting the bullet and using wxPython for the same purpose recently, it is heavy, but it didn't have any affect on the script performance.
I'll add a late reply to the mix. I think this is an interesting option worth looking at:
http://www.quicksplash.net