Created
September 28, 2021 20:05
-
-
Save Maxime-Favier/1489669a1ec4dedf0289113d6ffdc768 to your computer and use it in GitHub Desktop.
cqrprop clone
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gi | |
gi.require_version('GdkPixbuf', '2.0') | |
from gi.repository import GdkPixbuf, GLib | |
gi.require_version("Gtk", "3.0") | |
from gi.repository import Gtk, Gdk | |
from PIL import Image | |
import requests | |
imggif = Image.open(requests.get("https://www.hamqsl.com/solar101pic.php", stream=True).raw) | |
imggif.load() | |
img = Image.new("RGB", imggif.size, (255, 255, 255)) | |
img.paste(imggif) | |
xpos = 1500 | |
ypos = 50 | |
class ShowPortrait(Gtk.Window): | |
def __init__(self): | |
Gtk.Window.__init__(self, title="CQRPROP") | |
self.set_type_hint(Gdk.WindowTypeHint.DESKTOP) | |
self.connect("destroy", Gtk.main_quit) | |
self.set_skip_taskbar_hint(True) | |
data = img.tobytes() | |
w, h = img.size | |
data = GLib.Bytes.new(data) | |
pixbuf = GdkPixbuf.Pixbuf.new_from_bytes(data, GdkPixbuf.Colorspace.RGB, | |
False, 8, w, h, w * 3) | |
image = Gtk.Image.new_from_pixbuf(pixbuf.copy()) | |
self.add(image) | |
self.move(xpos, ypos) | |
self.show_all() | |
ShowPortrait() | |
Gtk.main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For some reason, my cqrprop (https://github.com/ok2cqr/cqrprop) installation doesn't work anymore. Made a small python script doing the same thing (with no auto update) in just 2 hour
To move the window adjust the xpos and ypos variables
To stop the script
kill "$(pgrep -f cqrprop.py)"
You could after theses adjustments configure your computer to auto start the program at startup
Modules used :
sudo apt-get install python3-gi
)pip install Pillow
)pip install requests
)73 de F4IQN
Resources used :
https://askubuntu.com/questions/969092/is-there-a-way-to-add-an-image-as-a-sticky-note-to-my-unity-desktop
https://lazka.github.io/pgi-docs/GdkPixbuf-2.0/classes/Pixbuf.html#GdkPixbuf.Pixbuf.new_from_bytes
https://gist.github.com/mozbugbox/10cd35b2872628246140
https://www.kite.com/python/answers/how-to-convert-a-rgba-image-to-a-rgb-image-with-pil-in-python