Python matplotlib.widgets() Examples
The following are 30
code examples of matplotlib.widgets().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
matplotlib
, or try the search function
.
Example #1
Source File: pyplot.py From GraphicDesignPatternByPython with MIT License | 6 votes |
def subplot_tool(targetfig=None): """ Launch a subplot tool window for a figure. A :class:`matplotlib.widgets.SubplotTool` instance is returned. """ tbar = rcParams['toolbar'] # turn off the navigation toolbar for the toolfig rcParams['toolbar'] = 'None' if targetfig is None: manager = get_current_fig_manager() targetfig = manager.canvas.figure else: # find the manager for this figure for manager in _pylab_helpers.Gcf._activeQue: if manager.canvas.figure == targetfig: break else: raise RuntimeError('Could not find manager for targetfig') toolfig = figure(figsize=(6,3)) toolfig.subplots_adjust(top=0.9) ret = SubplotTool(targetfig, toolfig) rcParams['toolbar'] = tbar _pylab_helpers.Gcf.set_active(manager) # restore the current figure return ret
Example #2
Source File: pyplot.py From twitter-stock-recommendation with MIT License | 6 votes |
def subplot_tool(targetfig=None): """ Launch a subplot tool window for a figure. A :class:`matplotlib.widgets.SubplotTool` instance is returned. """ tbar = rcParams['toolbar'] # turn off the navigation toolbar for the toolfig rcParams['toolbar'] = 'None' if targetfig is None: manager = get_current_fig_manager() targetfig = manager.canvas.figure else: # find the manager for this figure for manager in _pylab_helpers.Gcf._activeQue: if manager.canvas.figure==targetfig: break else: raise RuntimeError('Could not find manager for targetfig') toolfig = figure(figsize=(6,3)) toolfig.subplots_adjust(top=0.9) ret = SubplotTool(targetfig, toolfig) rcParams['toolbar'] = tbar _pylab_helpers.Gcf.set_active(manager) # restore the current figure return ret
Example #3
Source File: backend_gtk.py From twitter-stock-recommendation with MIT License | 6 votes |
def on_combobox_lineprops_changed(self, item): 'update the widgets from the active line' if not self._inited: return self._updateson = False line = self.get_active_line() ls = line.get_linestyle() if ls is None: ls = 'None' self.cbox_linestyles.set_active(self.linestyled[ls]) marker = line.get_marker() if marker is None: marker = 'None' self.cbox_markers.set_active(self.markerd[marker]) rgba = mcolors.to_rgba(line.get_color()) color = gtk.gdk.Color(*[int(val*65535) for val in rgba[:3]]) button = self.wtree.get_widget('colorbutton_linestyle') button.set_color(color) rgba = mcolors.to_rgba(line.get_markerfacecolor()) color = gtk.gdk.Color(*[int(val*65535) for val in rgba[:3]]) button = self.wtree.get_widget('colorbutton_markerface') button.set_color(color) self._updateson = True
Example #4
Source File: backend_gtk.py From twitter-stock-recommendation with MIT License | 6 votes |
def _update(self): 'update the active line props from the widgets' if not self._inited or not self._updateson: return line = self.get_active_line() ls = self.get_active_linestyle() marker = self.get_active_marker() line.set_linestyle(ls) line.set_marker(marker) button = self.wtree.get_widget('colorbutton_linestyle') color = button.get_color() r, g, b = [val/65535. for val in (color.red, color.green, color.blue)] line.set_color((r,g,b)) button = self.wtree.get_widget('colorbutton_markerface') color = button.get_color() r, g, b = [val/65535. for val in (color.red, color.green, color.blue)] line.set_markerfacecolor((r,g,b)) line.figure.canvas.draw()
Example #5
Source File: pyplot.py From CogAlg with MIT License | 6 votes |
def subplot_tool(targetfig=None): """ Launch a subplot tool window for a figure. A :class:`matplotlib.widgets.SubplotTool` instance is returned. """ tbar = rcParams['toolbar'] # turn off navigation toolbar for the toolfig rcParams['toolbar'] = 'None' if targetfig is None: manager = get_current_fig_manager() targetfig = manager.canvas.figure else: # find the manager for this figure for manager in _pylab_helpers.Gcf._activeQue: if manager.canvas.figure == targetfig: break else: raise RuntimeError('Could not find manager for targetfig') toolfig = figure(figsize=(6, 3)) toolfig.subplots_adjust(top=0.9) ret = SubplotTool(targetfig, toolfig) rcParams['toolbar'] = tbar _pylab_helpers.Gcf.set_active(manager) # restore the current figure return ret
Example #6
Source File: pyplot.py From coffeegrindsize with MIT License | 6 votes |
def subplot_tool(targetfig=None): """ Launch a subplot tool window for a figure. A :class:`matplotlib.widgets.SubplotTool` instance is returned. """ tbar = rcParams['toolbar'] # turn off the navigation toolbar for the toolfig rcParams['toolbar'] = 'None' if targetfig is None: manager = get_current_fig_manager() targetfig = manager.canvas.figure else: # find the manager for this figure for manager in _pylab_helpers.Gcf._activeQue: if manager.canvas.figure == targetfig: break else: raise RuntimeError('Could not find manager for targetfig') toolfig = figure(figsize=(6,3)) toolfig.subplots_adjust(top=0.9) ret = SubplotTool(targetfig, toolfig) rcParams['toolbar'] = tbar _pylab_helpers.Gcf.set_active(manager) # restore the current figure return ret
Example #7
Source File: matplotlib_example.py From wxGlade with MIT License | 6 votes |
def on_button_multicursor(self, event): from matplotlib.widgets import MultiCursor axes = self.canvas.figure.axes if event.IsChecked() and not self.multicursor and axes: # add multicursor self.multicursor = MultiCursor(self.canvas, axes, color='r', lw=1, horizOn=True, vertOn=True) elif self.multicursor: # remove multicursor self.multicursor.disconnect() self.multicursor = None self.canvas.draw() event.Skip() #################################################################################################################### # draw elements on canvas plot areas / axes (by coordinates)
Example #8
Source File: omas_plot.py From omas with MIT License | 6 votes |
def label_shifter(n, kw): """ Interprets label shift instructions :param n: int Number of labels that need shift instructions :param kw: dict Keywords passed to main plot script; label shifting keywords will be removed :return: (1D array with length >= n, 1D array with length >= n) R shifts Z shifts """ label_dr = kw.pop('label_r_shift', 0) label_dz = kw.pop('label_z_shift', 0) label_dr = padded_extension(label_dr, n, fill_value=label_dr if numpy.isscalar(label_dr) else 0) label_dz = padded_extension(label_dz, n, fill_value=label_dz if numpy.isscalar(label_dz) else 0) return label_dr, label_dz # hold last 100 references of matplotlib.widgets.Slider
Example #9
Source File: script_generation_interactive.py From transparent_latent_gan with MIT License | 6 votes |
def create_button(idx_feature): """ function to built button groups for one feature """ x, y, w, h = get_loc_control(idx_feature) plt.text(x+w/2, y+h/2+0.01, feature_name[idx_feature], horizontalalignment='center', transform=plt.gcf().transFigure) ax_neg = plt.axes((x + w / 8, y, w / 4, h / 2)) b_neg = widgets.Button(ax_neg, '-', hovercolor='0.1') b_neg.on_clicked(lambda event: callback.modify_along_feature(event, idx_feature, step_size=-1 * step_size)) ax_pos = plt.axes((x + w *5/8, y, w / 4, h / 2)) b_pos = widgets.Button(ax_pos, '+', hovercolor='0.1') b_pos.on_clicked(lambda event: callback.modify_along_feature(event, idx_feature, step_size=+1 * step_size)) ax_lock = plt.axes((x + w * 3/8, y, w / 4, h / 2)) b_lock = widgets.CheckButtons(ax_lock, ['L'], [False]) b_lock.on_clicked(lambda event: callback.set_feature_lock(event, idx_feature)) return b_neg, b_pos, b_lock
Example #10
Source File: backend_gtk3.py From ImageFusion with MIT License | 6 votes |
def _update(self): 'update the active line props from the widgets' if not self._inited or not self._updateson: return line = self.get_active_line() ls = self.get_active_linestyle() marker = self.get_active_marker() line.set_linestyle(ls) line.set_marker(marker) button = self.wtree.get_widget('colorbutton_linestyle') color = button.get_color() r, g, b = [val/65535. for val in (color.red, color.green, color.blue)] line.set_color((r,g,b)) button = self.wtree.get_widget('colorbutton_markerface') color = button.get_color() r, g, b = [val/65535. for val in (color.red, color.green, color.blue)] line.set_markerfacecolor((r,g,b)) line.figure.canvas.draw()
Example #11
Source File: backend_gtk.py From ImageFusion with MIT License | 6 votes |
def on_combobox_lineprops_changed(self, item): 'update the widgets from the active line' if not self._inited: return self._updateson = False line = self.get_active_line() ls = line.get_linestyle() if ls is None: ls = 'None' self.cbox_linestyles.set_active(self.linestyled[ls]) marker = line.get_marker() if marker is None: marker = 'None' self.cbox_markers.set_active(self.markerd[marker]) r,g,b = colorConverter.to_rgb(line.get_color()) color = gtk.gdk.Color(*[int(val*65535) for val in (r,g,b)]) button = self.wtree.get_widget('colorbutton_linestyle') button.set_color(color) r,g,b = colorConverter.to_rgb(line.get_markerfacecolor()) color = gtk.gdk.Color(*[int(val*65535) for val in (r,g,b)]) button = self.wtree.get_widget('colorbutton_markerface') button.set_color(color) self._updateson = True
Example #12
Source File: backend_gtk.py From ImageFusion with MIT License | 6 votes |
def _update(self): 'update the active line props from the widgets' if not self._inited or not self._updateson: return line = self.get_active_line() ls = self.get_active_linestyle() marker = self.get_active_marker() line.set_linestyle(ls) line.set_marker(marker) button = self.wtree.get_widget('colorbutton_linestyle') color = button.get_color() r, g, b = [val/65535. for val in (color.red, color.green, color.blue)] line.set_color((r,g,b)) button = self.wtree.get_widget('colorbutton_markerface') color = button.get_color() r, g, b = [val/65535. for val in (color.red, color.green, color.blue)] line.set_markerfacecolor((r,g,b)) line.figure.canvas.draw()
Example #13
Source File: pyplot.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 6 votes |
def subplot_tool(targetfig=None): """ Launch a subplot tool window for a figure. A :class:`matplotlib.widgets.SubplotTool` instance is returned. """ tbar = rcParams['toolbar'] # turn off the navigation toolbar for the toolfig rcParams['toolbar'] = 'None' if targetfig is None: manager = get_current_fig_manager() targetfig = manager.canvas.figure else: # find the manager for this figure for manager in _pylab_helpers.Gcf._activeQue: if manager.canvas.figure == targetfig: break else: raise RuntimeError('Could not find manager for targetfig') toolfig = figure(figsize=(6,3)) toolfig.subplots_adjust(top=0.9) ret = SubplotTool(targetfig, toolfig) rcParams['toolbar'] = tbar _pylab_helpers.Gcf.set_active(manager) # restore the current figure return ret
Example #14
Source File: pyplot.py From neural-network-animation with MIT License | 6 votes |
def subplot_tool(targetfig=None): """ Launch a subplot tool window for a figure. A :class:`matplotlib.widgets.SubplotTool` instance is returned. """ tbar = rcParams['toolbar'] # turn off the navigation toolbar for the toolfig rcParams['toolbar'] = 'None' if targetfig is None: manager = get_current_fig_manager() targetfig = manager.canvas.figure else: # find the manager for this figure for manager in _pylab_helpers.Gcf._activeQue: if manager.canvas.figure==targetfig: break else: raise RuntimeError('Could not find manager for targetfig') toolfig = figure(figsize=(6,3)) toolfig.subplots_adjust(top=0.9) ret = SubplotTool(targetfig, toolfig) rcParams['toolbar'] = tbar _pylab_helpers.Gcf.set_active(manager) # restore the current figure return ret
Example #15
Source File: backend_gtk3.py From neural-network-animation with MIT License | 6 votes |
def _update(self): 'update the active line props from the widgets' if not self._inited or not self._updateson: return line = self.get_active_line() ls = self.get_active_linestyle() marker = self.get_active_marker() line.set_linestyle(ls) line.set_marker(marker) button = self.wtree.get_widget('colorbutton_linestyle') color = button.get_color() r, g, b = [val/65535. for val in (color.red, color.green, color.blue)] line.set_color((r,g,b)) button = self.wtree.get_widget('colorbutton_markerface') color = button.get_color() r, g, b = [val/65535. for val in (color.red, color.green, color.blue)] line.set_markerfacecolor((r,g,b)) line.figure.canvas.draw()
Example #16
Source File: backend_gtk.py From Computable with MIT License | 6 votes |
def _update(self): 'update the active line props from the widgets' if not self._inited or not self._updateson: return line = self.get_active_line() ls = self.get_active_linestyle() marker = self.get_active_marker() line.set_linestyle(ls) line.set_marker(marker) button = self.wtree.get_widget('colorbutton_linestyle') color = button.get_color() r, g, b = [val/65535. for val in (color.red, color.green, color.blue)] line.set_color((r,g,b)) button = self.wtree.get_widget('colorbutton_markerface') color = button.get_color() r, g, b = [val/65535. for val in (color.red, color.green, color.blue)] line.set_markerfacecolor((r,g,b)) line.figure.canvas.draw()
Example #17
Source File: backend_gtk.py From neural-network-animation with MIT License | 6 votes |
def _update(self): 'update the active line props from the widgets' if not self._inited or not self._updateson: return line = self.get_active_line() ls = self.get_active_linestyle() marker = self.get_active_marker() line.set_linestyle(ls) line.set_marker(marker) button = self.wtree.get_widget('colorbutton_linestyle') color = button.get_color() r, g, b = [val/65535. for val in (color.red, color.green, color.blue)] line.set_color((r,g,b)) button = self.wtree.get_widget('colorbutton_markerface') color = button.get_color() r, g, b = [val/65535. for val in (color.red, color.green, color.blue)] line.set_markerfacecolor((r,g,b)) line.figure.canvas.draw()
Example #18
Source File: backend_gtk.py From Computable with MIT License | 6 votes |
def on_combobox_lineprops_changed(self, item): 'update the widgets from the active line' if not self._inited: return self._updateson = False line = self.get_active_line() ls = line.get_linestyle() if ls is None: ls = 'None' self.cbox_linestyles.set_active(self.linestyled[ls]) marker = line.get_marker() if marker is None: marker = 'None' self.cbox_markers.set_active(self.markerd[marker]) r,g,b = colorConverter.to_rgb(line.get_color()) color = gtk.gdk.Color(*[int(val*65535) for val in (r,g,b)]) button = self.wtree.get_widget('colorbutton_linestyle') button.set_color(color) r,g,b = colorConverter.to_rgb(line.get_markerfacecolor()) color = gtk.gdk.Color(*[int(val*65535) for val in (r,g,b)]) button = self.wtree.get_widget('colorbutton_markerface') button.set_color(color) self._updateson = True
Example #19
Source File: mpl.py From spotpy with MIT License | 6 votes |
def __init__(self, rect, wtype, *args, **kwargs): """ Creates a matplotlib.widgets widget :param rect: The rectangle of the position [left, bottom, width, height] in relative figure coordinates :param wtype: A type from matplotlib.widgets, eg. Button, Slider, TextBox, RadioButtons :param args: Positional arguments passed to the widget :param kwargs: Keyword arguments passed to the widget and events used for the widget eg. if wtype is Slider, on_changed=f can be used as keyword argument """ self.ax = plt.axes(rect) events = {} for k in list(kwargs.keys()): if k.startswith('on_'): events[k] = kwargs.pop(k) self.object = wtype(self.ax, *args, **kwargs) for k in events: if hasattr(self.object, k): getattr(self.object, k)(events[k])
Example #20
Source File: backend_gtk3.py From Computable with MIT License | 6 votes |
def _update(self): 'update the active line props from the widgets' if not self._inited or not self._updateson: return line = self.get_active_line() ls = self.get_active_linestyle() marker = self.get_active_marker() line.set_linestyle(ls) line.set_marker(marker) button = self.wtree.get_widget('colorbutton_linestyle') color = button.get_color() r, g, b = [val/65535. for val in color.red, color.green, color.blue] line.set_color((r,g,b)) button = self.wtree.get_widget('colorbutton_markerface') color = button.get_color() r, g, b = [val/65535. for val in color.red, color.green, color.blue] line.set_markerfacecolor((r,g,b)) line.figure.canvas.draw()
Example #21
Source File: pyplot.py From matplotlib-4-abaqus with MIT License | 6 votes |
def subplot_tool(targetfig=None): """ Launch a subplot tool window for a figure. A :class:`matplotlib.widgets.SubplotTool` instance is returned. """ tbar = rcParams['toolbar'] # turn off the navigation toolbar for the toolfig rcParams['toolbar'] = 'None' if targetfig is None: manager = get_current_fig_manager() targetfig = manager.canvas.figure else: # find the manager for this figure for manager in _pylab_helpers.Gcf._activeQue: if manager.canvas.figure==targetfig: break else: raise RuntimeError('Could not find manager for targetfig') toolfig = figure(figsize=(6,3)) toolfig.subplots_adjust(top=0.9) ret = SubplotTool(targetfig, toolfig) rcParams['toolbar'] = tbar _pylab_helpers.Gcf.set_active(manager) # restore the current figure return ret
Example #22
Source File: backend_gtk3.py From matplotlib-4-abaqus with MIT License | 6 votes |
def _update(self): 'update the active line props from the widgets' if not self._inited or not self._updateson: return line = self.get_active_line() ls = self.get_active_linestyle() marker = self.get_active_marker() line.set_linestyle(ls) line.set_marker(marker) button = self.wtree.get_widget('colorbutton_linestyle') color = button.get_color() r, g, b = [val/65535. for val in color.red, color.green, color.blue] line.set_color((r,g,b)) button = self.wtree.get_widget('colorbutton_markerface') color = button.get_color() r, g, b = [val/65535. for val in color.red, color.green, color.blue] line.set_markerfacecolor((r,g,b)) line.figure.canvas.draw()
Example #23
Source File: pyplot.py From Computable with MIT License | 6 votes |
def subplot_tool(targetfig=None): """ Launch a subplot tool window for a figure. A :class:`matplotlib.widgets.SubplotTool` instance is returned. """ tbar = rcParams['toolbar'] # turn off the navigation toolbar for the toolfig rcParams['toolbar'] = 'None' if targetfig is None: manager = get_current_fig_manager() targetfig = manager.canvas.figure else: # find the manager for this figure for manager in _pylab_helpers.Gcf._activeQue: if manager.canvas.figure==targetfig: break else: raise RuntimeError('Could not find manager for targetfig') toolfig = figure(figsize=(6,3)) toolfig.subplots_adjust(top=0.9) ret = SubplotTool(targetfig, toolfig) rcParams['toolbar'] = tbar _pylab_helpers.Gcf.set_active(manager) # restore the current figure return ret
Example #24
Source File: backend_gtk.py From neural-network-animation with MIT License | 6 votes |
def on_combobox_lineprops_changed(self, item): 'update the widgets from the active line' if not self._inited: return self._updateson = False line = self.get_active_line() ls = line.get_linestyle() if ls is None: ls = 'None' self.cbox_linestyles.set_active(self.linestyled[ls]) marker = line.get_marker() if marker is None: marker = 'None' self.cbox_markers.set_active(self.markerd[marker]) r,g,b = colorConverter.to_rgb(line.get_color()) color = gtk.gdk.Color(*[int(val*65535) for val in (r,g,b)]) button = self.wtree.get_widget('colorbutton_linestyle') button.set_color(color) r,g,b = colorConverter.to_rgb(line.get_markerfacecolor()) color = gtk.gdk.Color(*[int(val*65535) for val in (r,g,b)]) button = self.wtree.get_widget('colorbutton_markerface') button.set_color(color) self._updateson = True
Example #25
Source File: backend_gtk.py From matplotlib-4-abaqus with MIT License | 6 votes |
def on_combobox_lineprops_changed(self, item): 'update the widgets from the active line' if not self._inited: return self._updateson = False line = self.get_active_line() ls = line.get_linestyle() if ls is None: ls = 'None' self.cbox_linestyles.set_active(self.linestyled[ls]) marker = line.get_marker() if marker is None: marker = 'None' self.cbox_markers.set_active(self.markerd[marker]) r,g,b = colorConverter.to_rgb(line.get_color()) color = gtk.gdk.Color(*[int(val*65535) for val in (r,g,b)]) button = self.wtree.get_widget('colorbutton_linestyle') button.set_color(color) r,g,b = colorConverter.to_rgb(line.get_markerfacecolor()) color = gtk.gdk.Color(*[int(val*65535) for val in (r,g,b)]) button = self.wtree.get_widget('colorbutton_markerface') button.set_color(color) self._updateson = True
Example #26
Source File: backend_gtk.py From matplotlib-4-abaqus with MIT License | 6 votes |
def _update(self): 'update the active line props from the widgets' if not self._inited or not self._updateson: return line = self.get_active_line() ls = self.get_active_linestyle() marker = self.get_active_marker() line.set_linestyle(ls) line.set_marker(marker) button = self.wtree.get_widget('colorbutton_linestyle') color = button.get_color() r, g, b = [val/65535. for val in (color.red, color.green, color.blue)] line.set_color((r,g,b)) button = self.wtree.get_widget('colorbutton_markerface') color = button.get_color() r, g, b = [val/65535. for val in (color.red, color.green, color.blue)] line.set_markerfacecolor((r,g,b)) line.figure.canvas.draw()
Example #27
Source File: backend_gtk3.py From matplotlib-4-abaqus with MIT License | 5 votes |
def __init__(self, lines): import Gtk.glade datadir = matplotlib.get_data_path() gladefile = os.path.join(datadir, 'lineprops.glade') if not os.path.exists(gladefile): raise IOError('Could not find gladefile lineprops.glade in %s'%datadir) self._inited = False self._updateson = True # suppress updates when setting widgets manually self.wtree = Gtk.glade.XML(gladefile, 'dialog_lineprops') self.wtree.signal_autoconnect(dict([(s, getattr(self, s)) for s in self.signals])) self.dlg = self.wtree.get_widget('dialog_lineprops') self.lines = lines cbox = self.wtree.get_widget('combobox_lineprops') cbox.set_active(0) self.cbox_lineprops = cbox cbox = self.wtree.get_widget('combobox_linestyles') for ls in self.linestyles: cbox.append_text(ls) cbox.set_active(0) self.cbox_linestyles = cbox cbox = self.wtree.get_widget('combobox_markers') for m in self.markers: cbox.append_text(m) cbox.set_active(0) self.cbox_markers = cbox self._lastcnt = 0 self._inited = True
Example #28
Source File: backend_gtk3.py From Computable with MIT License | 5 votes |
def __init__(self, lines): import Gtk.glade datadir = matplotlib.get_data_path() gladefile = os.path.join(datadir, 'lineprops.glade') if not os.path.exists(gladefile): raise IOError('Could not find gladefile lineprops.glade in %s'%datadir) self._inited = False self._updateson = True # suppress updates when setting widgets manually self.wtree = Gtk.glade.XML(gladefile, 'dialog_lineprops') self.wtree.signal_autoconnect(dict([(s, getattr(self, s)) for s in self.signals])) self.dlg = self.wtree.get_widget('dialog_lineprops') self.lines = lines cbox = self.wtree.get_widget('combobox_lineprops') cbox.set_active(0) self.cbox_lineprops = cbox cbox = self.wtree.get_widget('combobox_linestyles') for ls in self.linestyles: cbox.append_text(ls) cbox.set_active(0) self.cbox_linestyles = cbox cbox = self.wtree.get_widget('combobox_markers') for m in self.markers: cbox.append_text(m) cbox.set_active(0) self.cbox_markers = cbox self._lastcnt = 0 self._inited = True
Example #29
Source File: backend_gtk.py From twitter-stock-recommendation with MIT License | 5 votes |
def __init__(self, lines): import gtk.glade datadir = matplotlib.get_data_path() gladefile = os.path.join(datadir, 'lineprops.glade') if not os.path.exists(gladefile): raise IOError( 'Could not find gladefile lineprops.glade in %s' % datadir) self._inited = False self._updateson = True # suppress updates when setting widgets manually self.wtree = gtk.glade.XML(gladefile, 'dialog_lineprops') self.wtree.signal_autoconnect( {s: getattr(self, s) for s in self.signals}) self.dlg = self.wtree.get_widget('dialog_lineprops') self.lines = lines cbox = self.wtree.get_widget('combobox_lineprops') cbox.set_active(0) self.cbox_lineprops = cbox cbox = self.wtree.get_widget('combobox_linestyles') for ls in self.linestyles: cbox.append_text(ls) cbox.set_active(0) self.cbox_linestyles = cbox cbox = self.wtree.get_widget('combobox_markers') for m in self.markers: cbox.append_text(m) cbox.set_active(0) self.cbox_markers = cbox self._lastcnt = 0 self._inited = True
Example #30
Source File: backend_gtk.py From matplotlib-4-abaqus with MIT License | 5 votes |
def __init__(self, lines): import gtk.glade datadir = matplotlib.get_data_path() gladefile = os.path.join(datadir, 'lineprops.glade') if not os.path.exists(gladefile): raise IOError('Could not find gladefile lineprops.glade in %s'%datadir) self._inited = False self._updateson = True # suppress updates when setting widgets manually self.wtree = gtk.glade.XML(gladefile, 'dialog_lineprops') self.wtree.signal_autoconnect(dict([(s, getattr(self, s)) for s in self.signals])) self.dlg = self.wtree.get_widget('dialog_lineprops') self.lines = lines cbox = self.wtree.get_widget('combobox_lineprops') cbox.set_active(0) self.cbox_lineprops = cbox cbox = self.wtree.get_widget('combobox_linestyles') for ls in self.linestyles: cbox.append_text(ls) cbox.set_active(0) self.cbox_linestyles = cbox cbox = self.wtree.get_widget('combobox_markers') for m in self.markers: cbox.append_text(m) cbox.set_active(0) self.cbox_markers = cbox self._lastcnt = 0 self._inited = True