I'm looking to write something in Python to make a GUI that shows: i) A list of checkboxes ii) A graph (of the data corresponding to the checked boxes) - preferably both of these in a single window, but it's OK if they have to be in separate windows. The data that is to be graphed will be coming from a .txt file and the checkboxes will control which parts of the text file are to be displayed/hidden.

Which Python library would work best for that (looking for ease of use, free, and ability to meet the basic reqs)? The main requirements is that a user can look at whichever combination of the data they want in the graph, so the plot updates as the user is clicking on the checkboxes.

After looking at a stackoverflow thread (lost the link and can't find it again, sorry), it seemed like PyQt+matplotlib could be a good option, but I wanted to get advice on if that would work well for me before I start spending too much time on them. Also not too sure on how I would combine a graph+table into one window; I'm new to combining libraries.


3 Answers 3


I would also suggest taking a look at wxPython which is the python bindings for wxWigets.

  • Native look and feel
  • Cross Platform
  • Free Libra & FOSS
  • Minimal external dependencies
  • Lots of editable examples in the Documents & Demos Package
  • Active and helpful community
  • Existing matplotlib back-end for wx

A very quick hack of the code from the link above gives:

#!/usr/bin/env python
An example of how to use wx or wxagg in an application with the new
toolbar - comment out the setA_toolbar line for no toolbar

# Used to guarantee to use at least Wx2.8
import wxversion

from numpy import arange, sin, pi

import matplotlib

# uncomment the following to use wx rather than wxagg
#from matplotlib.backends.backend_wx import FigureCanvasWx as FigureCanvas

# comment out the following to use wx rather than wxagg
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas

from matplotlib.backends.backend_wx import NavigationToolbar2Wx

from matplotlib.figure import Figure

import wx

class CanvasFrame(wx.Frame):

    def __init__(self):


        self.figure = Figure()
        self.axes = self.figure.add_subplot(111)
        t = arange(0.0,3.0,0.01)
        s = sin(2*pi*t)

        self.canvas = FigureCanvas(self, -1, self.figure)
        sampleList = ['zero', 'one', 'two', 'three', 'four', 'five',
                      'six', 'seven', 'eight', 'nine', 'ten', 'eleven',
                      'twelve', 'thirteen', 'fourteen']
        lb = wx.CheckListBox(self, -1, (80, 50), wx.DefaultSize, sampleList)
        # You will need to add some event handlers
        #self.Bind(wx.EVT_LISTBOX, self.EvtListBox, lb)
        #self.Bind(wx.EVT_CHECKLISTBOX, self.EvtCheckListBox, lb)
        self.listbox = lb

        self.sizer = wx.BoxSizer(wx.VERTICAL)
        self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
        self.sizer.Add(self.listbox, 0, wx.RIGHT | wx.TOP)

        self.add_toolbar()  # comment this out for no toolbar

    def add_toolbar(self):
        self.toolbar = NavigationToolbar2Wx(self.canvas)
        if wx.Platform == '__WXMAC__':
            # Mac platform (OSX 10.3, MacPython) does not seem to cope with
            # having a toolbar in a sizer. This work-around gets the buttons
            # back, but at the expense of having the toolbar at the top
            # On Windows platform, default window size is incorrect, so set
            # toolbar width to figure width.
            tw, th = self.toolbar.GetSizeTuple()
            fw, fh = self.canvas.GetSizeTuple()
            # By adding toolbar in sizer, we are able to put it at the bottom
            # of the frame - so appearance is closer to GTK version.
            # As noted above, doesn't work for Mac.
            self.toolbar.SetSize(wx.Size(fw, th))
            self.sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND)
        # update the axes menu on the toolbar

    def OnPaint(self, event):

class App(wx.App):

    def OnInit(self):
        'Create the main window and insert the custom frame'
        frame = CanvasFrame()

        return True

app = App(0)

Hacked Demo


PySimpleGUI is a new package that wraps tkinter that supports Matplotlib graphs. It's ideal for programs that need access to the basic GUI widgets like checkboxes, radio buttons, listboxes, etc, but don't need a full-blown GUI framework such as Qt. Sometimes there is a need for a somewhere between just starting and Qt and this may be one answer to that need.

There are a few Demo programs in the GitHub that show how to integrate with Matplotlib to display graphs. With it you should be able to write a program that collects the data to be graphed using GUI widgets, creates a graph using Matplotlib or Pyplot that can then be shown. enter image description here


PyQt and matplotlib. The PyQt library is very robust and very diverse. I have used it to create an application very similar to what you are looking to do. It does take a little effort to get past the initial understanding of how to create GUI apps using Python and PyQt. I solid understanding of Object Oriented Programming is a must. Good Luck.

  • Great, thanks for the response! I'll try to remember to post back here with an update once I've gotten done some work on it
    – rwicks
    Commented Jan 9, 2015 at 21:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.