Skip to content

Instantly share code, notes, and snippets.

View driscollis's full-sized avatar

Mike Driscoll driscollis

View GitHub Profile
import psutil
import simplejson
import time
import urllib2
# Sends the CPU and memory usage stats to Loggly. Sends both a machine total and per process.
def log():
""""""
proc_dict = {}
@driscollis
driscollis / wxfreeze.py
Created November 7, 2014 22:23
wxPython freeze/thaw example
import wx
class MyForm(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, wx.ID_ANY, "Tutorial", size=(500,500))
self.btnNum = 1
# Add a panel so it looks the correct on all platforms
self.panel = wx.Panel(self, wx.ID_ANY)
import wx
########################################################################
class MyFrame(wx.Frame):
""""""
#----------------------------------------------------------------------
def __init__(self):
"""Constructor"""
wx.Frame.__init__(self, parent=None, title="Hello World!")
@driscollis
driscollis / wx_sizer_ex.py
Last active August 29, 2015 14:14
wxPython - expanding controls
import wx
import os
class MainWindow(wx.Frame):
def __init__(self,parent,title):
wx.Frame.__init__(self, parent, title=title)
self.workbookDir = r'C:\Users\Nick\Desktop'
self.workbookName = 'rota.xlsx'
self.panel = wx.Panel(self)
self.label = wx.StaticText(self.panel, label = 'Workbook path: ')
@driscollis
driscollis / wx_id.py
Created March 31, 2015 14:11
wxPython ID sample
import wx
########################################################################
class MyPanel(wx.Panel):
""""""
#----------------------------------------------------------------------
def __init__(self, parent):
"""Constructor"""
wx.Panel.__init__(self, parent)
import wx
########################################################################
class MyPanel(wx.Panel):
""""""
#----------------------------------------------------------------------
def __init__(self, parent):
"""Constructor"""
wx.Panel.__init__(self, parent)
@driscollis
driscollis / custom_toolbar.py
Created April 8, 2015 16:56
Creating a custom toolbar in wxPython
import wx
########################################################################
class MyCustomToolbar(wx.Panel):
""""""
#----------------------------------------------------------------------
def __init__(self, parent):
"""Constructor"""
wx.Panel.__init__(self, parent)
@driscollis
driscollis / images.py
Created April 10, 2015 14:13
images from wxPython demo
#----------------------------------------------------------------------
# This file was generated by encode_bitmaps.py
#
from wx.lib.embeddedimage import PyEmbeddedImage
Mondrian = PyEmbeddedImage(
"iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABHNCSVQICAgIfAhkiAAAAHFJ"
"REFUWIXt1jsKgDAQRdF7xY25cpcWC60kioI6Fm/ahHBCMh+BRmGMnAgEWnvPpzK8dvrFCCCA"
"coD8og4c5Lr6WB3Q3l1TBwLYPuF3YS1gn1HphgEEEABcKERrGy0E3B0HFJg7C1N/f/kTBBBA"
"+Vi+AMkgFEvBPD17AAAAAElFTkSuQmCC")
@driscollis
driscollis / wxmax.py
Created April 16, 2015 21:08
wxPython maximize example
import wx
class MyFrame(wx.Frame):
def __init__(self):
style = (wx.DEFAULT_FRAME_STYLE|wx.MAXIMIZE) & ~ (wx.RESIZE_BORDER|wx.MINIMIZE_BOX)
wx.Frame.__init__(self, None, title='Test')
panel = wx.Panel(self)
btn = wx.Button(panel, label="Close")
btn.Bind(wx.EVT_BUTTON, self.onClose)
import subprocess
import wx
########################################################################
class MyPanel(wx.Panel):
""""""
#----------------------------------------------------------------------
def __init__(self, parent):
"""Constructor"""