当小部件之一处于焦点时,按钮“G”、“H”工作,但“F”不工作。
我的代码:
# -*- coding: UTF-8 -*-
import numpy
from 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')
for 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)
当我取消注释此行时
binding_manager=MyBindings_manager
我收到错误:
TypeError: __init__() takes exactly 1 argument (2 given)
我究竟做错了什么?