当前位置: 首页>>代码示例>>Python>>正文


Python Plot.place方法代码示例

本文整理汇总了Python中plot.Plot.place方法的典型用法代码示例。如果您正苦于以下问题:Python Plot.place方法的具体用法?Python Plot.place怎么用?Python Plot.place使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在plot.Plot的用法示例。


在下文中一共展示了Plot.place方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Datamonitor

# 需要导入模块: from plot import Plot [as 别名]
# 或者: from plot.Plot import place [as 别名]
class Datamonitor(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent)
        self.parent = parent
        # create plots for drawing on
        self.accel_plot = Plot(self, ylabel="Acceleration (g)", numy=3, xrng=10, name="ACCEL")
        self.gyro_plot = Plot(self, ylabel="Angular Velocity (degrees/s)", numy=3, xrng=10, name="GYRO")
        self.mag_plot = Plot(self, ylabel="Field Strength", numy=3, xrng=10, name="MAG")
        self.plots = (self.accel_plot, self.gyro_plot, self.mag_plot)
        self.attitude_plot = Tiltmeter(self)
        self.x = 0
        self.y = 0
        self.width = 0
        self.height = 0
        self.plotnext = 0

    def place(self, x, y, width, height):
        # fit all plots in window
        self.x = x
        self.y = y
        self.width = width
        self.height = height
        figureheight = height/3-4/3*bw
        figurewidth = width-2*bw 
        self.accel_plot.place(x=bw, y=bw, width=figurewidth, height=figureheight)
        self.gyro_plot.place(x=bw, y=figureheight+2*bw, width=figurewidth, height=figureheight)
        self.mag_plot.place(x=bw, y=2*figureheight+3*bw, width=figurewidth-bw-figureheight, height=figureheight)
        self.attitude_plot.place(x=width-figureheight-bw, y=2*figureheight+3*bw, width=figureheight, height=figureheight) 

    def show(self):
        self.accel_plot.show(True)
        self.gyro_plot.show(True)
        self.mag_plot.show(True)
        self.attitude_plot.show(True)
        self.update()

    def hide(self):
        self.accel_plot.show(False)
        self.gyro_plot.show(False)
        self.mag_plot.show(False)
        self.attitude_plot.show(False)

    def update(self):
        self.place(self.x, self.y, self.width, self.height)

    def refresh(self):
        self.plots[self.plotnext].draw()
        self.plotnext = (self.plotnext + 1) % len(self.plots)

    def reset(self):
        for plot in self.plots:
            plot.reset()
        self.attitude_plot.reset()

    def destroy(self):
        self.accel_plot.destroy()
        self.gyro_plot.destroy()
        self.mag_plot.destroy()
开发者ID:QUASR,项目名称:QRET-GUI,代码行数:60,代码来源:datamonitor.py


注:本文中的plot.Plot.place方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。