Skip to content

Instantly share code, notes, and snippets.

View holdenweb's full-sized avatar

Steve Holden holdenweb

View GitHub Profile
from textual.app import App, ComposeResult
from textual.widget import Widget
from textual.widgets import Static, Rule
from textual.containers import Vertical, Horizontal, VerticalScroll
from rich.text import Text
from typing import Callable
DEFAULT_SELECTED_FORMAT = "\\[{v} [@click='klick({i})']x[/]]"
DEFAULT_UNSELECTED_FORMAT = "\\[[@click='klick({i})']{v}[/]]"
@holdenweb
holdenweb / app_skel.py
Created September 6, 2023 15:40
Where does the markup come from?
from textual.app import App, ComposeResult
from lib import SaveCancel
class SkelApp(App):
"""A Textual app in which to drop test functionality."""
def compose(self) -> ComposeResult:
"""Create child widgets for the app."""
yield SaveCancel(self.report)
@holdenweb
holdenweb / qt_flask.py
Created April 12, 2023 20:19
Skeleton flask server with QT interface
'''
qtflask.py: Run a flask server as a subordinate thread to a Qt GUI application
'''
import sys
import threading
from PyQt6.QtWidgets import QApplication, QWidget, QPushButton, QMessageBox
from flask import Flask, jsonify
class App(QWidget):
@holdenweb
holdenweb / LocalServerThread.ipynb
Created March 31, 2020 11:51
Simple example of how to serve iFrames from a notebook-local server thread
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@holdenweb
holdenweb / Traitlets2.ipynb
Created September 29, 2016 12:17
Traits Early Experiments 2
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@holdenweb
holdenweb / Traitlets.ipynb
Created September 29, 2016 11:49
Traitlets early experiments
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@holdenweb
holdenweb / Practicing.ipynb
Last active January 2, 2016 18:09
Practising Python (1)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import tweepy
from BeautifulSoup import BeautifulSoup as parser
import urllib
consumer_key=''
consumer_secret=''
access_token=''
access_token_secret=''
@holdenweb
holdenweb / SillyThreading.ipynb
Created January 18, 2013 06:46
Some code it isn't reasonable to expect to run in a notebook?
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.