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


Python Window.set_minimum_size方法代码示例

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


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

示例1: MyField

# 需要导入模块: from window import Window [as 别名]
# 或者: from window.Window import set_minimum_size [as 别名]
class MyField(Field):
    """An object representing the field.  """

    cellClass = MyCell
    connectorClass = MyConnector
    groupClass = MyGroup

    def __init__(self):

        self.m_xmin_field = XMIN_FIELD
        self.m_ymin_field = YMIN_FIELD
        self.m_xmax_field = XMAX_FIELD
        self.m_ymax_field = YMAX_FIELD
        self.m_xmin_vector = XMIN_VECTOR
        self.m_ymin_vector = YMIN_VECTOR
        self.m_xmax_vector = XMAX_VECTOR
        self.m_ymax_vector = YMAX_VECTOR
        self.m_xmin_screen = XMIN_SCREEN
        self.m_ymin_screen = YMIN_SCREEN
        self.m_xmax_screen = XMAX_SCREEN
        self.m_ymax_screen = YMAX_SCREEN
        self.m_path_unit = PATH_UNIT
        self.m_path_scale = 1.0/self.m_path_unit
        self.m_screen_scale = 1
        self.m_vector_scale = 1
        # our default margins, one will be overwriten below
        self.m_xmargin = int(self.m_xmax_screen*DEF_MARGIN)
        self.m_ymargin = int(self.m_ymax_screen*DEF_MARGIN)
        self.set_scaling()
        self.m_screen = object
        self.m_pathgrid = object
        self.m_pathfinder = object
        super(MyField, self).__init__()
        self.make_path_grid()

    # Screen Stuff

    def init_screen(self):
        # initialize window
        #(xmax_screen,ymax_screen) = self.screenMax()
        width = self.m_xmax_screen - self.m_xmin_screen
        height = self.m_ymax_screen - self.m_ymin_screen
        if dbug.LEV & dbug.FIELD: print "field:init_screen"
        self.m_screen = Window(self,width=width,height=height)
        # set window background color = r, g, b, alpha
        # each value goes from 0.0 to 1.0
        # ... perform some additional initialisation
        # moved to window class
        #pyglet.gl.glClearColor(*DEF_BKGDCOLOR)
        #self.m_screen.clear()
        # register draw routing with pyglet
        # TESTED: These functions are being called correctly, and params are
        # being passed correctly
        self.m_screen.set_minimum_size(XMAX_SCREEN/4, YMAX_SCREEN/4)
        self.m_screen.set_visible()

    # Scaling

    def set_scaling(self,pmin_field=None,pmax_field=None,pmin_vector=None,pmax_vector=None,
                      pmin_screen=None,pmax_screen=None,path_unit=None):
        """Set up scaling in the field.

        A word about graphics scaling:
         * The vision tracking system (our input data) measures in meters.
         * The laser DAC measures in uh, int16? -32,768 to 32,768
         * Pyglet measures in pixels at the screen resolution of the window you create
         * The pathfinding units are each some ratio of the smallest expected radius

         So we will keep eveything internally in centemeters (so we can use ints
         instead of floats), and then convert it to the appropriate units before 
         display depending on the output mode

         """

        if pmin_field is not None:
            self.m_xmin_field = pmin_field[0]
            self.m_ymin_field = pmin_field[1]
        if pmax_field is not None:
            self.m_xmax_field = pmax_field[0]
            self.m_ymax_field = pmax_field[1]
        if pmin_vector is not None:
            self.m_xmin_vector = pmin_vector[0]
            self.m_ymin_vector = pmin_vector[1]
        if pmax_vector is not None:
            self.m_xmax_vector  = pmax_vector[0]
            self.m_ymax_vector  = pmax_vector[1]
        if pmin_screen is not None:
            self.m_xmin_screen = pmin_screen[0]
            self.m_ymin_screen = pmin_screen[1]
        if pmax_screen is not None:
            self.m_xmax_screen = pmax_screen[0]
            self.m_ymax_screen = pmax_screen[1]
        if path_unit is not None:
            self.m_path_unit = path_unit
            self.m_path_scale = 1.0/path_unit
        xmin_field = self.m_xmin_field
        ymin_field = self.m_ymin_field
        xmax_field = self.m_xmax_field
        ymax_field = self.m_ymax_field
        xmin_vector = self.m_xmin_vector
#.........这里部分代码省略.........
开发者ID:btownshend,项目名称:crs,代码行数:103,代码来源:myfield.py


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