Python3 Gtk3 Thread Example

Quick Python3 Gtk3 app to execute Python scripts to test long running threads in Gtk3 app. Some things could be better, like the python paths collection and displaying the PID, but I was focused on running threads without freezing the GUI and it just kind of happened. Hope it’s useful to someone.

Create mov,mp4 thumbnails from Python3

I was working on a Gtk 3 project to roll up all my iPhone videos into a flowbox for easy locating and processing since iPhone doesn’t name things in a meaningful way and photo managers dump things into not so meaningful folders, thumbnails was a must to locate videos easily. Plus, I wanted to do […]

GTK3 Calendar dialog example in Python.

  #!/usr/bin/python3 import gi gi.require_version(‘Gtk’, ‘3.0’) from gi.repository import Gtk, Gio, GObject GObject.threads_init() class CalDialog(Gtk.Dialog): ”’ Calendar Dialog ”’ def __init__(self, parent): Gtk.Dialog.__init__(self, “Select Date”, parent, 0, (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OK, Gtk.ResponseType.OK)) self.set_default_size(300, 200) self.value = None box = self.get_content_area() calendar = Gtk.Calendar() calendar.set_detail_height_rows(1) calendar.set_property(“show-details”,True) calendar.set_detail_func(self.cal_entry) box.add(calendar) self.show_all() def cal_entry(self, calendar, year, month, date): #print(year, month, […]

Install Virtuoso 6.1.6 for use with Python 3 on LinuxMint 18

Install the following from the Software Manager (use apt if you prefer): Virtuoso-opensource Virtuoso-server Virtuoso-vad-conductor Virtuoso-vad-isparql Virtuoso-vsp-startpage Virtuoso-opensource-6.1 Virtuoso-opensource-6.1-bin Virtuoso-opensource-61-common Unixodbc Libvirtodbc0 Download zip and Install PyODBC from https://github.com/maparent/pyodbc/tree/v3-virtuoso Unzip, cd into the expended folder, then type: $ sudo python setup.py build install Add the following in the odbc.ini: $ sudo nano /etc/odbc.ini Add the […]

Sort list by column preserving index. 

This is yet another reason I love Python!  This is good for something like generating HTML tables with rowspans that you want sorted. Each tuple is a row, each item in the tuple is a cell. If you sort this data it will change the index so if you set a rowspan on the first […]

Batch base64 encode PNGs in Python 3 for use in CSS.

I wrote a simple Python 3 script to base64 encode a series of PNG images for use in CSS, or whatever. If you’re learning Python add file output or even go a step further and generate the CSS lines. If you’re here I will assume you are wanting these for CSS but if not, here […]