Example #1
0
    def __init__(self):
        wxFrame.__init__(self, None, -1, "Test embedded wxFigure")
        self.fig = Figure(self, -1, (5, 4), 75)
        self.toolbar = Toolbar(self.fig)
        self.toolbar.Realize()

        # On Windows, default frame size behaviour is incorrect
        # you don't need this under Linux
        tw, th = self.toolbar.GetSizeTuple()
        fw, fh = self.fig.GetSizeTuple()
        self.toolbar.SetSize(wxSize(fw, th))

        # Create a figure manager to manage things
        self.figmgr = FigureManager(self.fig, 1, self)

        # Now put all into a sizer
        sizer = wxBoxSizer(wxVERTICAL)
        # This way of adding to sizer prevents resizing
        #sizer.Add(self.fig, 0, wxLEFT|wxTOP)

        # This way of adding to sizer allows resizing
        sizer.Add(self.fig, 1, wxLEFT | wxTOP | wxGROW)

        # Best to allow the toolbar to resize!
        sizer.Add(self.toolbar, 0, wxGROW)
        self.SetSizer(sizer)
        self.Fit()
        EVT_TIMER(self, TIMER_ID, self.onTimer)
Example #2
0
class PlotFigure(wxFrame):
    def __init__(self):
        wxFrame.__init__(self, None, -1, "Test embedded wxFigure")
        self.fig = Figure(self, -1, (5, 4), 75)
        self.toolbar = Toolbar(self.fig)
        self.toolbar.Realize()

        # On Windows, default frame size behaviour is incorrect
        # you don't need this under Linux
        tw, th = self.toolbar.GetSizeTuple()
        fw, fh = self.fig.GetSizeTuple()
        self.toolbar.SetSize(wxSize(fw, th))

        # Create a figure manager to manage things
        self.figmgr = FigureManager(self.fig, 1, self)

        # Now put all into a sizer
        sizer = wxBoxSizer(wxVERTICAL)
        # This way of adding to sizer prevents resizing
        # sizer.Add(self.fig, 0, wxLEFT|wxTOP)

        # This way of adding to sizer allows resizing
        sizer.Add(self.fig, 1, wxLEFT | wxTOP | wxGROW)

        # Best to allow the toolbar to resize!
        sizer.Add(self.toolbar, 0, wxGROW)
        self.SetSizer(sizer)
        self.Fit()
        EVT_TIMER(self, TIMER_ID, self.onTimer)

    def init_plot_data(self):
        a = self.figmgr.add_subplot(111)
        self.ind = numpy.arange(60)
        tmp = []
        for i in range(60):
            tmp.append(numpy.sin((self.ind + i) * numpy.pi / 15))
        self.X = numpy.array(tmp)
        self.lines = a.plot(self.X[:, 0], "o")
        self.count = 0

    def GetToolBar(self):
        # You will need to override GetToolBar if you are using an
        # unmanaged toolbar in your frame
        return self.toolbar

    def onTimer(self, evt):
        self.count += 1
        if self.count > 99:
            self.count = 0
        self.lines[0].set_data(self.ind, self.X[:, self.count])
        self.fig.draw()
        self.fig.gui_repaint()
Example #3
0
class PlotFigure(wxFrame):
    def __init__(self):
        wxFrame.__init__(self, None, -1, "Test embedded wxFigure")
        self.fig = Figure(self, -1, (5, 4), 75)
        self.toolbar = Toolbar(self.fig)
        self.toolbar.Realize()

        # On Windows, default frame size behaviour is incorrect
        # you don't need this under Linux
        tw, th = self.toolbar.GetSizeTuple()
        fw, fh = self.fig.GetSizeTuple()
        self.toolbar.SetSize(wxSize(fw, th))

        # Create a figure manager to manage things
        self.figmgr = FigureManager(self.fig, 1, self)

        # Now put all into a sizer
        sizer = wxBoxSizer(wxVERTICAL)
        # This way of adding to sizer prevents resizing
        #sizer.Add(self.fig, 0, wxLEFT|wxTOP)

        # This way of adding to sizer allows resizing
        sizer.Add(self.fig, 1, wxLEFT | wxTOP | wxGROW)

        # Best to allow the toolbar to resize!
        sizer.Add(self.toolbar, 0, wxGROW)
        self.SetSizer(sizer)
        self.Fit()
        EVT_TIMER(self, TIMER_ID, self.onTimer)

    def init_plot_data(self):
        a = self.figmgr.add_subplot(111)
        self.ind = numpy.arange(60)
        tmp = []
        for i in range(60):
            tmp.append(numpy.sin((self.ind + i) * numpy.pi / 15))
        self.X = numpy.array(tmp)
        self.lines = a.plot(self.X[:, 0], 'o')
        self.count = 0

    def GetToolBar(self):
        # You will need to override GetToolBar if you are using an
        # unmanaged toolbar in your frame
        return self.toolbar

    def onTimer(self, evt):
        self.count += 1
        if self.count > 99: self.count = 0
        self.lines[0].set_data(self.ind, self.X[:, self.count])
        self.fig.draw()
        self.fig.gui_repaint()
Example #4
0
    def __init__(self):
        wxFrame.__init__(self, None, -1, "Test embedded wxFigure")
        self.fig = Figure(self, -1, (5,4), 75)
        self.toolbar = Toolbar(self.fig)
        self.toolbar.Realize()

		# On Windows, default frame size behaviour is incorrect
        # you don't need this under Linux
        tw, th = self.toolbar.GetSizeTuple()
        fw, fh = self.fig.GetSizeTuple()
        self.toolbar.SetSize(wxSize(fw, th))
        
        # Create a figure manager to manage things
        self.figmgr = FigureManager(self.fig, 1, self)
        
        # Now put all into a sizer
        sizer = wxBoxSizer(wxVERTICAL)
		# This way of adding to sizer prevents resizing
        #sizer.Add(self.fig, 0, wxLEFT|wxTOP)
		
		# This way of adding to sizer allows resizing
        sizer.Add(self.fig, 1, wxLEFT|wxTOP|wxGROW)
		
		# Best to allow the toolbar to resize!
        sizer.Add(self.toolbar, 0, wxGROW)
        self.SetSizer(sizer)
        self.Fit()
        EVT_TIMER(self, TIMER_ID, self.onTimer)
Example #5
0
from matplotlib.backends import Figure
from matplotlib.axes import Subplot
import Numeric as numpy
import gtk

win = gtk.Window()
win.set_name("Embedding in GTK")
win.connect("destroy", gtk.mainquit)
win.set_border_width(5)

vbox = gtk.VBox(spacing=3)
win.add(vbox)
vbox.show()

f = Figure(figsize=(5,4), dpi=100)
a = Subplot(f, 111)
t = numpy.arange(0.0,3.0,0.01)
s = numpy.sin(2*numpy.pi*t)

a.plot(t,s)
f.add_axis(a)
f.show()
vbox.pack_start(f)

button = gtk.Button('Quit')
button.connect('clicked', lambda b: gtk.mainquit())
button.show()
vbox.pack_start(button)

win.show()
Example #6
0
from matplotlib.backends import Figure
from matplotlib.axes import Subplot
import Numeric as numpy
import gtk

win = gtk.Window()
win.set_name("Embedding in GTK")
win.connect("destroy", gtk.mainquit)
win.set_border_width(5)

vbox = gtk.VBox(spacing=3)
win.add(vbox)
vbox.show()

f = Figure(figsize=(5, 4), dpi=100)
a = Subplot(f, 111)
t = numpy.arange(0.0, 3.0, 0.01)
s = numpy.sin(2 * numpy.pi * t)

a.plot(t, s)
f.add_axes(a)
f.show()
vbox.pack_start(f)

button = gtk.Button('Quit')
button.connect('clicked', lambda b: gtk.mainquit())
button.show()
vbox.pack_start(button)

win.show()
Example #7
0
File: eeg.py Project: langit/revman
from matplotlib.backends import Figure
from matplotlib.axes import Subplot
import Numeric as numpy
import gtk

win = gtk.Window()
win.set_name("Embedding in GTK")
win.connect("destroy", gtk.mainquit)
win.set_border_width(5)

vbox = gtk.VBox(spacing=3)
win.add(vbox)
vbox.show()

f = Figure(figsize=(5,4), dpi=100)
a = Subplot(f, 111)
t = numpy.arange(0.0,3.0,0.01)
s = numpy.sin(2*numpy.pi*t)

a.plot(t,s)
f.add_axes(a)
f.show()
vbox.pack_start(f)

button = gtk.Button('Quit')
button.connect('clicked', lambda b: gtk.mainquit())
button.show()
vbox.pack_start(button)

win.show()