Skip to content

Instantly share code, notes, and snippets.

View driscollis's full-sized avatar

Mike Driscoll driscollis

View GitHub Profile
@driscollis
driscollis / vehicle.py
Created October 13, 2021 13:34
Type hinting quiz
# vehicle.py
from collections import namedtuple
class Vehicle:
def __init__(self, name, veh_type):
self.name = name
self.veh_type = veh_type
self.add_ons = []
# password_generator_gui.py
import PySimpleGUI as sg
def main():
layout = [
[sg.Text("Password:"), sg.Input(size=(25, 1), key="-PASSWORD-")],
[
sg.Text("Length:"),
import sys
from PIL import Image, ImageQt
from PyQt5.QtGui import QPixmap, QImage
from PyQt5.QtWidgets import QWidget, QLabel
from PyQt5.QtWidgets import QVBoxLayout, QApplication
class ImageViewer(QWidget):
# image_viewer.py
import io
import wx
class ImagePanel(wx.Panel):
def __init__(self, parent, image_size):
super().__init__(parent)
self.max_size = 240
# kivy_image.py
from kivy.app import App
from kivy.uix.image import Image
class ImageViewer(App):
def build(self):
return Image(source="processed_flower.jpg")
import wx
class MainFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, title='')
panel = wx.Panel(self)
self.statusbar = self.CreateStatusBar(
1, style=wx.STB_SIZEGRIP|wx.STB_ELLIPSIZE_END|wx.FULL_REPAINT_ON_RESIZE)
@driscollis
driscollis / watermark_transparent.py
Last active January 12, 2021 02:26
PySimpleGUI watermarking utility
# watermark_transparent.py
from PIL import Image
def watermark_with_transparency(input_image_path, output_image_path,
watermark_image_path, position):
base_image = Image.open(input_image_path)
watermark = Image.open(watermark_image_path)
width, height = base_image.size
import pathlib
import PySimpleGUI as sg
from PIL import Image, ImageTk
supported_image_types = [".png", ".jpg", "jpeg", ".tiff", ".bmp"]
elements = [
[sg.Image(key="-IMAGE-")],
[
sg.Text("Image Folder"),
import wx
class ImagePanel(wx.Panel):
def __init__(self, parent, image_size):
super().__init__(parent)
self.max_size = 240
self.file_path = None
img = wx.Image(*image_size)
177 INFO: PyInstaller: 3.6
178 INFO: Python: 3.8.2
179 INFO: Platform: Windows-10-10.0.10586-SP0
186 INFO: wrote C:\Users\mike\OneDrive\Documents\image_viewer_psg.spec
192 INFO: UPX is not available.
221 INFO: Extending PYTHONPATH with paths
['C:\\Users\\mike\\OneDrive\\Documents', 'C:\\Users\\mike\\OneDrive\\Documents']
225 INFO: checking Analysis
229 INFO: Building Analysis because Analysis-00.toc is non existent
231 INFO: Initializing module dependency graph...