wiicop.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:wiicop 作者: barnabuskev 项目源码 文件源码
def __init__(self,aqc_info,BB_X,BB_Y):
        self.acq_info = aqc_info
        # Initial instructions
        self.text_start = 'Press Spacebar to start recording'
        self.text_stop = 'Press Spacebar to stop recording'
        # remove toolbar
        mpl.rcParams['toolbar'] = 'None'
        # Create new figure and an axes which fills it...
        # set figure width in inches
        fig_width = 12
        # set fig ratio based on size of bboard rectange whose corners are sensors
        self.fig = plt.figure(figsize=(fig_width, fig_width*BB_Y/BB_X))
        self.fig.canvas.set_window_title(aqc_name(self.acq_info))
        # frameon determines whether background of frame will be drawn
        ax = self.fig.add_axes([0, 0, 1, 1], frameon=False)
        ax.set_xlim(-BB_X/2, BB_X/2), ax.set_xticks([])
        ax.set_ylim(-BB_Y/2, BB_Y/2), ax.set_yticks([])
        # create a scatter object at initial position 0,0
        self.scat = ax.scatter(0, 0, s=200, lw=0.5, facecolors='green')
        # create text box
        self.text_h = ax.text(0.02, 0.98, self.text_start, verticalalignment='top',horizontalalignment='left',
        transform=ax.transAxes, fontsize=12, bbox=dict(facecolor='white'), gid = 'notrec')
        # create timer object
        if self.acq_info['acq_time'] != 'inf':
            acq_time_ms = int(self.acq_info['acq_time'])*1000
            self.acq_timer = self.fig.canvas.new_timer(interval=acq_time_ms)
            self.acq_timer.add_callback(self.t_event)
        # attach keypress event handler to figure canvas
        self.fig.canvas.mpl_connect('key_press_event', self.onkeypress)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号