q_plot.py 文件源码

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

项目:cadee 作者: kamerlinlab 项目源码 文件源码
def __init__(self, parent, plotdata, plotdata_files):
        self.parent = parent
        self.plots = plotdata   # example:  { "dgde" : { 0 : QPlotData_instance (from file 1), 1 : QPlotData_instance (from file 2) }, ... }, where 0,1,... are indices of the filenames in plotdata_files
        self.plotdata_files = plotdata_files    #  [ "/home/.../pro/qa.PlotData.pickle", "/home/.../wat/qa.PlotData.pickle" ]
        self.nrows = 1
        self.ncols = 1
        self.blocked_draw = False
        self.subplot_lines = {}
        self.COLORS_ACTIVE = ("#555555","#F75D59","#1589FF", "black", "red", "blue")
        self.COLORS_INACTIVE = ("#aaaaaa","#F7bDb9","#a5a9FF", "#999999", "#FFaaaa", "#aaaaFF")


        self.lb1_entries = ODict()
        for plot_key, plot in self.plots.iteritems():
            self.lb1_entries[ plot.values()[0].title ] = plot_key

        self.lb1 = Tk.Listbox(self.parent, selectmode=Tk.EXTENDED, exportselection=0)

        for plot_title in self.lb1_entries.keys():
            self.lb1.insert(Tk.END, plot_title)

        self.lb1.pack(fill=Tk.Y, side=Tk.LEFT)
        self.lb2 = Tk.Listbox(self.parent, selectmode=Tk.EXTENDED, exportselection=0)
        self.lb2.pack(fill=Tk.Y, side=Tk.LEFT)

        self.figure = Figure(figsize=(5,4), dpi=100)


        self.canvas = FigureCanvasTkAgg(self.figure, master=self.parent)
        self.canvas.get_tk_widget().pack()
        self.canvas._tkcanvas.pack(fill=Tk.BOTH, expand=1)

        self.toolbar = NavigationToolbar2TkAgg( self.canvas, self.parent )
        self.toolbar.update()
        self.canvas._tkcanvas.pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)

        self.lb1.bind("<<ListboxSelect>>", self.on_select_lb1)
        self.lb2.bind("<<ListboxSelect>>", self.on_select_lb2)
        self.parent.bind("<Configure>", self.on_resize)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号