buttons 'g','h' working when 1 of widgets in focus, 'f' not.
my code:
# -*- coding: utf-8 -*- import numpy galry import * class mypaintmanager(plotpaintmanager): def initialize(self): self.add_visual(plotvisual, x=self.parent.x, y=self.parent.y, color='b') class mybindings_manager(bindings): def initialize_default(self): super(mybindings_manager, self).initialize_default() self.set_fullscreen() self.set('keypress', 'fullscreen', key='f') class mywidget(galrywidget): def initialize(self, x, y): self.activate_grid = true self.show_grid = true self.is_fullscreen = true self.x = x self.y = y self.set_companion_classes( paint_manager=mypaintmanager, interaction_manager=plotinteractionmanager, # binding_manager=mybindings_manager ) self.initialize_companion_classes() class window(qtgui.qwidget): def __init__(self): super(window, self).__init__() self.initui() def initui(self): layout = qtgui.qgridlayout(self) samplerate = 30000. channelcount = 20 data = np.random.normal(size=1000000) newdata = data.reshape(channelcount,-1, order='f') channelnum in range(channelcount): count = len(newdata[channelnum]) x = np.linspace(0, count / samplerate, count) graph = mywidget(x=x, y=newdata[channelnum]) layout.addwidget(graph, channelnum % 4, channelnum / 4) self.setlayout(layout) self.show() if __name__ == '__main__': show_window(window)
when uncommented line
binding_manager=mybindings_manager
i got error:
typeerror: __init__() takes 1 argument (2 given)
what doing wrong?
your bindingsmanager
should of type plotbindings
, , doesn't need set companion class.
take @ https://github.com/klusta-team/klustaviewa/blob/master/klustaviewa/views/traceview.py see how it's done, example.
galry obsolete , has been superceded vispy it's not best choice of library build new application with!
Comments
Post a Comment