本文整理汇总了Python中matplotlib.backends.backend_gtkagg.NavigationToolbar2GTKAgg.set_size_request方法的典型用法代码示例。如果您正苦于以下问题:Python NavigationToolbar2GTKAgg.set_size_request方法的具体用法?Python NavigationToolbar2GTKAgg.set_size_request怎么用?Python NavigationToolbar2GTKAgg.set_size_request使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.backends.backend_gtkagg.NavigationToolbar2GTKAgg
的用法示例。
在下文中一共展示了NavigationToolbar2GTKAgg.set_size_request方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_figure_canvas
# 需要导入模块: from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg [as 别名]
# 或者: from matplotlib.backends.backend_gtkagg.NavigationToolbar2GTKAgg import set_size_request [as 别名]
def add_figure_canvas(self, w=700, h=500):
"""Note: this method assumed self.main_hbox is already
defined. A figure canvas with a toolbar at the bottom is
added to self.main_hbox."""
self.fig = Figure(figsize=(8,6), dpi=100)
self.ax = self.fig.add_subplot(111)
t = arange(0.0,3.0,0.01)
s = sin(2*pi*t)
self.ax.plot(t,s)
self.figcanvas = FigureCanvas(self.fig) # a gtk.DrawingArea
self.figcanvas.show()
self.canvas_vbox = gtk.VBox()
toolbar = NavigationToolbar(self.figcanvas, self.window)
#toolbar.set_size_request(-1,50)
self.figcanvas.set_size_request(w,h)
toolbar.set_size_request(w,50)
toolbar.show()
self.canvas_vbox.pack_start(self.figcanvas)#, expand=True, \
#fill=True, padding=5)
self.canvas_vbox.pack_start(toolbar, False)#, False)#, padding=5)
self.main_hbox.pack_start(self.canvas_vbox)#, expand=True, \
示例2: Figure
# 需要导入模块: from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg [as 别名]
# 或者: from matplotlib.backends.backend_gtkagg.NavigationToolbar2GTKAgg import set_size_request [as 别名]
buttons['Save'] = gtk.ToolButton(gtk.STOCK_SAVE_AS)
buttons['ReMesh'] = gtk.Button("ReMesh")
buttons['MachDown'] = gtk.ToolButton(gtk.STOCK_GO_BACK)
buttons['MachDisp'] = gtk.Button("")
buttons['MachUp'] = gtk.ToolButton(gtk.STOCK_GO_FORWARD)
buttons['ReDown'] = gtk.ToolButton(gtk.STOCK_GO_BACK)
buttons['ReDisp'] = gtk.Button("")
buttons['ReUp'] = gtk.ToolButton(gtk.STOCK_GO_FORWARD)
buttons['NEDown'] = gtk.ToolButton(gtk.STOCK_GO_BACK)
buttons['NEDisp'] = gtk.Button("")
buttons['NEUp'] = gtk.ToolButton(gtk.STOCK_GO_FORWARD)
fig = Figure()
canvas = FigureCanvas(fig) # a gtk.DrawingArea
nav = NavigationToolbar(canvas, win)
nav.set_size_request(250, 35);
sep = [gtk.SeparatorToolItem() for i in range(10)]
toolbar = gtk.HBox(False, 2)
toolbar.pack_start(buttons['New'], False, False, 0)
toolbar.pack_start(buttons['Open'], False, False, 0)
toolbar.pack_start(buttons['Save'], False, False, 0)
toolbar.pack_start(sep[0], False, False, 0)
toolbar.pack_start(nav, False, False, 0)
toolbar.pack_start(sep[1], False, False, 0)
toolbar.pack_start(combobox, False, False, 0)
toolbar.pack_start(sep[2], False, False, 0)
toolbar.pack_start(buttons['ReMesh'], False, False, 0)
toolbar.pack_start(sep[3], False, False, 0)
toolbar.pack_start(buttons['MachDown'], False, False, 0)
示例3: __init__
# 需要导入模块: from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg [as 别名]
# 或者: from matplotlib.backends.backend_gtkagg.NavigationToolbar2GTKAgg import set_size_request [as 别名]
def __init__(self):
self.debug = 0
self.test = RTP.Motor_PD_Control_Test(kp=2, kd=0.07)
# create a new window
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
# When the window is given the "delete_event" signal (this is given
# by the window manager, usually by the "close" option, or on the
# titlebar), we ask it to call the delete_event () function
# as defined above. The data passed to the callback
# function is NULL and is ignored in the callback function.
self.window.connect("delete_event", self.delete_event)
# Here we connect the "destroy" event to a signal handler.
# This event occurs when we call gtk_widget_destroy() on the window,
# or if we return FALSE in the "delete_event" callback.
self.window.connect("destroy", self.destroy)
# Sets the border width of the window.
self.window.set_border_width(10)
# Creates a new button with the label "Hello World".
self.swept_sine_button = gtk.Button("Swept Sine")
self.step_button = gtk.Button("Step Response")
self.reset_button = gtk.Button("Reset Theta")
self.return_button = gtk.Button("Return to 0")
self.sys_check_button = gtk.Button("System Check")
self.ol_step_button = gtk.Button("OL Step")
#self.vib_check = gtk.CheckButton(label="Use Vibration Suppression", \
# use_underline=False)
self.vib_on_radio = gtk.RadioButton(None, "On")
self.vib_off_radio = gtk.RadioButton(self.vib_on_radio, "Off")
#button.connect("toggled", self.callback, "radio button 2")
self.vib_off_radio.set_active(True)
vib_label = gtk.Label("Vibration Suppression")
ol_label = gtk.Label("OL Step Response")
ol_hbox = gtk.HBox(homogeneous=False)
amp_label = gtk.Label("amp:")
dur_label = gtk.Label("duration:")
self.ol_amp_entry = gtk.Entry()
self.ol_amp_entry.set_max_length(7)
self.ol_amp_entry.set_text("150")
Entry_width = 50
self.ol_amp_entry.set_size_request(Entry_width,-1)
self.dur_entry = gtk.Entry()
self.dur_entry.set_max_length(7)
self.dur_entry.set_text("300")
self.dur_entry.set_size_request(Entry_width,-1)
ol_hbox.pack_end(self.ol_amp_entry, False)
ol_hbox.pack_end(amp_label, False)
#ol_hbox.pack_start(amp_label, False)
#ol_hbox.pack_start(self.ol_amp_entry, False)
ol_dur_box = gtk.HBox(homogeneous=False)
ol_dur_box.pack_end(self.dur_entry, False)
ol_dur_box.pack_end(dur_label, False)
#Fixed Sine Controls
self.fs_amp_entry = gtk.Entry()
self.fs_amp_entry.set_max_length(7)
self.fs_amp_entry.set_size_request(Entry_width, -1)
self.fs_amp_entry.set_text("5")
self.fs_freq_entry = gtk.Entry()
self.fs_freq_entry.set_max_length(7)
self.fs_freq_entry.set_size_request(Entry_width, -1)
self.fs_freq_entry.set_text("0.5")
self.fs_dur_entry = gtk.Entry()
self.fs_dur_entry.set_max_length(7)
self.fs_dur_entry.set_size_request(Entry_width, -1)
self.fs_dur_entry.set_text("300")
fs_label = gtk.Label('Fixed Sine')
fs_amp_label = gtk.Label("amp (counts):")
fs_freq_label = gtk.Label("freq (Hz):")
fs_dur_label = gtk.Label("duration:")
fsvbox = gtk.VBox(homogeneous=False, spacing=5)
fsvbox.show()
fsvbox.pack_start(fs_label)
fshbox1 = gtk.HBox(homogeneous=False)
fshbox1.pack_end(self.fs_amp_entry, False)
fshbox1.pack_end(fs_amp_label, False)
fsvbox.pack_start(fshbox1, False)
fshbox2 = gtk.HBox(homogeneous=False)
fshbox2.pack_end(self.fs_freq_entry, False)
fshbox2.pack_end(fs_freq_label, False)
fsvbox.pack_start(fshbox2, False)
fshbox3 = gtk.HBox(homogeneous=False)
fshbox3.pack_end(self.fs_dur_entry, False)
fshbox3.pack_end(fs_dur_label, False)
fsvbox.pack_start(fshbox3, False)
self.fixed_sine_button = gtk.Button("Fixed Sine")
fsvbox.pack_start(self.fixed_sine_button, False)
#ol_dur_box.pack_start(dur_label, False)
#ol_dur_box.pack_start(self.dur_entry, False)
sep0 = gtk.HSeparator()
sep1 = gtk.HSeparator()
sep2 = gtk.HSeparator()
sep3 = gtk.HSeparator()
#.........这里部分代码省略.........