Skip to content

Instantly share code, notes, and snippets.

View driscollis's full-sized avatar

Mike Driscoll driscollis

View GitHub Profile
# tree_experiments.py
from rich.text import Text
from textual.app import App, ComposeResult
from textual.widgets import Tree
class TreeApp(App):
def compose(self) -> ComposeResult:
self.top_level_nodes: dict[str, int] = {}
from textual.app import App, ComposeResult
from textual.widgets import Button, Label
from textual.screen import ModalScreen
from textual.containers import Grid
class WarningDialog(ModalScreen):
def compose(self) -> ComposeResult:
yield Grid(
Label("Are you sure you want to quit?", id="question"),
TestNodes {
align: center middle;
}
#datatable {
height: 50%;
}
#remote_button, #tab-help-button {
background: green;
# simple_color_picker.py
from textual import on
from textual._color_constants import ANSI_COLORS, COLOR_NAME_TO_RGB
from textual.app import App, ComposeResult
from textual.containers import Center, Horizontal, Vertical
from textual.screen import ModalScreen
from textual.widgets import Button, Header, Select, Placeholder
class SimpleColorPickerDialog(ModalScreen):
@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)