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


Python wx.Point方法代码示例

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


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

示例1: _init_ctrls

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Point [as 别名]
def _init_ctrls(self, prnt):
        wx.Frame.__init__(self, id=ID_OBJDICTEDIT, name='objdictedit',
              parent=prnt, pos=wx.Point(149, 178), size=wx.Size(1000, 700),
              style=wx.DEFAULT_FRAME_STYLE, title=_('Objdictedit'))
        self._init_utils()
        self.SetClientSize(wx.Size(1000, 700))
        self.SetMenuBar(self.MenuBar)
        self.Bind(wx.EVT_CLOSE, self.OnCloseFrame)
        if not self.ModeSolo:
            self.Bind(wx.EVT_MENU, self.OnSaveMenu, id=wx.ID_SAVE)
            accel = wx.AcceleratorTable([wx.AcceleratorEntry(wx.ACCEL_CTRL, 83, wx.ID_SAVE)])
            self.SetAcceleratorTable(accel)

        self.FileOpened = wx.Notebook(id=ID_OBJDICTEDITFILEOPENED,
              name='FileOpened', parent=self, pos=wx.Point(0, 0),
              size=wx.Size(0, 0), style=0)
        self.FileOpened.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED,
              self.OnFileSelectedChanged, id=ID_OBJDICTEDITFILEOPENED)

        self.HelpBar = wx.StatusBar(id=ID_OBJDICTEDITHELPBAR, name='HelpBar',
              parent=self, style=wx.ST_SIZEGRIP)
        self._init_coll_HelpBar_Fields(self.HelpBar)
        self.SetStatusBar(self.HelpBar) 
开发者ID:jgeisler0303,项目名称:CANFestivino,代码行数:25,代码来源:objdictedit.py

示例2: _init_ctrls

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Point [as 别名]
def _init_ctrls(self, prnt):
        wx.Frame.__init__(self, id=ID_NETWORKEDIT, name='networkedit',
              parent=prnt, pos=wx.Point(149, 178), size=wx.Size(1000, 700),
              style=wx.DEFAULT_FRAME_STYLE, title=_('Networkedit'))
        self._init_utils()
        self.SetClientSize(wx.Size(1000, 700))
        self.SetMenuBar(self.MenuBar)
        self.Bind(wx.EVT_CLOSE, self.OnCloseFrame)
        if not self.ModeSolo:
            self.Bind(wx.EVT_MENU, self.OnSaveProjectMenu, id=wx.ID_SAVE)
            accel = wx.AcceleratorTable([wx.AcceleratorEntry(wx.ACCEL_CTRL, 83, wx.ID_SAVE)])
            self.SetAcceleratorTable(accel)

        NetworkEditorTemplate._init_ctrls(self, self)

        self.HelpBar = wx.StatusBar(id=ID_NETWORKEDITHELPBAR, name='HelpBar',
              parent=self, style=wx.ST_SIZEGRIP)
        self._init_coll_HelpBar_Fields(self.HelpBar)
        self.SetStatusBar(self.HelpBar) 
开发者ID:jgeisler0303,项目名称:CANFestivino,代码行数:21,代码来源:networkedit.py

示例3: Render

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Point [as 别名]
def Render(self, cell, dc, state):
        position = cell.GetPosition()
        for device in self._Devices:
            box = self.GetTextExtent(device['name'])
            RADIUS = DeviceListRenderer.CORNER_RADIUS

            if device['vendor'] == 'nvidia':
                color = self._ColorDb.Find('LIME GREEN')
            else:
                color = self._ColorDb.Find('LIGHT GREY')
            dc.SetBrush(wx.Brush(color))
            dc.SetPen(wx.TRANSPARENT_PEN)
            shadeRect = wx.Rect(
                    position,
                    wx.Size(box.GetWidth() + RADIUS*2, box.GetHeight() + RADIUS*2))
            dc.DrawRoundedRectangle(shadeRect, RADIUS)

            textRect = wx.Rect(
                    wx.Point(position.x + RADIUS, position.y + RADIUS), box)
            self.RenderText(device['name'], 0, textRect, dc, state)

            position = wx.Point(
                    position.x, (position.y + box.GetHeight() + RADIUS*2 + RADIUS))
        return True 
开发者ID:YoRyan,项目名称:nuxhash,代码行数:26,代码来源:mining.py

示例4: RefreshConnectors

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Point [as 别名]
def RefreshConnectors(self):
        scaling = self.Parent.GetScaling()
        # Calculate the size for the connector lines
        lines = max(len(self.Inputs), len(self.Outputs))
        if lines > 0:
            linesize = max((self.Size[1] - BLOCK_LINE_SIZE) // lines, BLOCK_LINE_SIZE)
            # Update inputs and outputs positions
            position = BLOCK_LINE_SIZE + linesize // 2
            for i in xrange(lines):
                if scaling is not None:
                    ypos = round_scaling(self.Pos.y + position, scaling[1]) - self.Pos.y
                else:
                    ypos = position
                if i < len(self.Inputs):
                    self.Inputs[i].SetPosition(wx.Point(0, ypos))
                if i < len(self.Outputs):
                    self.Outputs[i].SetPosition(wx.Point(self.Size[0], ypos))
                position += linesize
        self.RefreshConnected()

    # Refresh the positions of wires connected to inputs and outputs 
开发者ID:thiagoralves,项目名称:OpenPLC_Editor,代码行数:23,代码来源:FBD_Objects.py

示例5: SetType

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Point [as 别名]
def SetType(self, type, value_type):
        if type != self.Type:
            self.Type = type
            # Create an input or output connector according to variable type
            if self.Type != INPUT:
                if self.Input is None:
                    self.Input = Connector(self, "", value_type, wx.Point(0, 0), WEST, onlyone=True)
            elif self.Input:
                self.Input.UnConnect(delete=True)
                self.Input = None
            if self.Type != OUTPUT:
                if self.Output is None:
                    self.Output = Connector(self, "", value_type, wx.Point(0, 0), EAST)
            elif self.Output:
                self.Output.UnConnect(delete=True)
                self.Output = None
            self.RefreshConnectors()
            self.RefreshBoundingBox()
        elif value_type != self.ValueType:
            if self.Input:
                self.Input.SetType(value_type)
            if self.Output:
                self.Output.SetType(value_type)

    # Returns the variable type 
开发者ID:thiagoralves,项目名称:OpenPLC_Editor,代码行数:27,代码来源:FBD_Objects.py

示例6: MoveConnector

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Point [as 别名]
def MoveConnector(self, connector, movey):
        position = connector.GetRelPosition()
        connector.SetPosition(wx.Point(position.x, position.y + movey))
        miny = self.Size[1]
        maxy = 0
        for connect in self.Connectors:
            connect_pos = connect.GetRelPosition()
            miny = min(miny, connect_pos.y - self.Extensions[0])
            maxy = max(maxy, connect_pos.y - self.Extensions[0])
        min_pos = self.Pos.y + miny
        self.Pos.y = min(min_pos, self.Pos.y)
        if min_pos == self.Pos.y:
            for connect in self.Connectors:
                connect_pos = connect.GetRelPosition()
                connect.SetPosition(wx.Point(connect_pos.x, connect_pos.y - miny))
        self.Connectors.sort(lambda x, y: cmp(x.Pos.y, y.Pos.y))
        maxy = 0
        for connect in self.Connectors:
            connect_pos = connect.GetRelPosition()
            maxy = max(maxy, connect_pos.y)
        self.Size[1] = max(maxy + self.Extensions[1], self.Size[1])
        connector.MoveConnected()
        self.RefreshBoundingBox()

    # Returns the index in connectors list for the connector given 
开发者ID:thiagoralves,项目名称:OpenPLC_Editor,代码行数:27,代码来源:LD_Objects.py

示例7: RefreshConnectors

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Point [as 别名]
def RefreshConnectors(self):
        scaling = self.Parent.GetScaling()
        height = self.Size[1] - self.Extensions[0] - self.Extensions[1]
        interval = height / max(len(self.Connectors) - 1, 1)
        for i, connector in enumerate(self.Connectors):
            if self.RealConnectors:
                position = self.Extensions[0] + int(round(self.RealConnectors[i] * height))
            else:
                position = self.Extensions[0] + int(round(i * interval))
            if scaling is not None:
                position = round((self.Pos.y + position) / scaling[1]) * scaling[1] - self.Pos.y
            if self.Type == LEFTRAIL:
                connector.SetPosition(wx.Point(self.Size[0], position))
            elif self.Type == RIGHTRAIL:
                connector.SetPosition(wx.Point(0, position))
        self.RefreshConnected()

    # Refresh the position of wires connected to power rail 
开发者ID:thiagoralves,项目名称:OpenPLC_Editor,代码行数:20,代码来源:LD_Objects.py

示例8: OnLeftDown

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Point [as 别名]
def OnLeftDown(self, event, dc, scaling):
        # Test if an handle have been clicked
        handle = self.TestHandle(event)
        # Find which type of handle have been clicked,
        # Save a resize event and change the cursor
        cursor = HANDLE_CURSORS.get(handle, 1)
        wx.CallAfter(self.Parent.SetCurrentCursor, cursor)
        if cursor > 1:
            self.Handle = (HANDLE_RESIZE, handle)
        else:
            self.Handle = (HANDLE_MOVE, None)
            self.SetSelected(False)
        # Initializes the last position
        self.oldPos = GetScaledEventPosition(event, dc, scaling)
        self.StartPos = wx.Point(self.Pos.x, self.Pos.y)
        self.CurrentDrag = wx.Point(0, 0)

    # Method called when a LeftUp event have been generated 
开发者ID:thiagoralves,项目名称:OpenPLC_Editor,代码行数:20,代码来源:GraphicCommons.py

示例9: DrawHighlightment

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Point [as 别名]
def DrawHighlightment(self, dc):
        scalex, scaley = dc.GetUserScale()
        dc.SetUserScale(1, 1)
        dc.SetPen(MiterPen(HIGHLIGHTCOLOR))
        dc.SetBrush(wx.Brush(HIGHLIGHTCOLOR))
        dc.SetLogicalFunction(wx.AND)

        left = (self.Pos.x - 1) * scalex - 2
        right = (self.Pos.x + self.Size[0] + 1) * scalex + 2
        top = (self.Pos.y - 1) * scaley - 2
        bottom = (self.Pos.y + self.Size[1] + 1) * scaley + 2
        angle_top = (self.Pos.x + self.Size[0] - 9) * scalex + 2
        angle_right = (self.Pos.y + 9) * scaley - 2

        polygon = [wx.Point(left, top), wx.Point(angle_top, top),
                   wx.Point(right, angle_right), wx.Point(right, bottom),
                   wx.Point(left, bottom)]
        dc.DrawPolygon(polygon)

        dc.SetLogicalFunction(wx.COPY)
        dc.SetUserScale(scalex, scaley)

    # Draws the comment and its content 
开发者ID:thiagoralves,项目名称:OpenPLC_Editor,代码行数:25,代码来源:GraphicCommons.py

示例10: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Point [as 别名]
def __init__(self, parent, name, initial=False, id=None):
        Graphic_Element.__init__(self, parent)
        DebugDataConsumer.__init__(self)
        self.SetName(name)
        self.Initial = initial
        self.Id = id
        self.Highlights = []
        self.Size = wx.Size(SFC_STEP_DEFAULT_SIZE[0], SFC_STEP_DEFAULT_SIZE[1])
        # Create an input and output connector
        if not self.Initial:
            self.Input = Connector(self, "", None, wx.Point(self.Size[0] // 2, 0), NORTH)
        else:
            self.Input = None
        self.Output = None
        self.Action = None
        self.PreviousValue = None
        self.PreviousSpreading = False 
开发者ID:thiagoralves,项目名称:OpenPLC_Editor,代码行数:19,代码来源:SFC_Objects.py

示例11: RefreshConnectors

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Point [as 别名]
def RefreshConnectors(self):
        scaling = self.Parent.GetScaling()
        horizontal_pos = self.Size[0] // 2
        vertical_pos = self.Size[1] // 2
        if scaling is not None:
            horizontal_pos = round((self.Pos.x + horizontal_pos) / scaling[0]) * scaling[0] - self.Pos.x
            vertical_pos = round((self.Pos.y + vertical_pos) / scaling[1]) * scaling[1] - self.Pos.y
        # Update input position
        self.Input.SetPosition(wx.Point(horizontal_pos, 0))
        # Update output position
        self.Output.SetPosition(wx.Point(horizontal_pos, self.Size[1]))
        if self.Type == "connection":
            self.Condition.SetPosition(wx.Point(0, vertical_pos))
        self.RefreshConnected()

    # Refresh the position of the wires connected to transition 
开发者ID:thiagoralves,项目名称:OpenPLC_Editor,代码行数:18,代码来源:SFC_Objects.py

示例12: SetType

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Point [as 别名]
def SetType(self, type, condition=None):
        if self.Type != type:
            if self.Type == "connection":
                self.Condition.UnConnect(delete=self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
            self.Type = type
            if type == "connection":
                self.Condition = Connector(self, "", "BOOL", wx.Point(0, self.Size[1] // 2), WEST)
            else:
                if condition is None:
                    condition = ""
                self.Condition = condition
                self.RefreshConditionSize()
        elif self.Type != "connection":
            if condition is None:
                condition = ""
            self.Condition = condition
            self.RefreshConditionSize()
        self.RefreshBoundingBox()

    # Returns the transition type 
开发者ID:thiagoralves,项目名称:OpenPLC_Editor,代码行数:22,代码来源:SFC_Objects.py

示例13: SetSize

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Point [as 别名]
def SetSize(self, width, height):
        height = self.GetMinSize()[1]
        for i, input in enumerate(self.Inputs):
            position = input.GetRelPosition()
            if self.RealConnectors:
                input.SetPosition(wx.Point(int(round(self.RealConnectors["Inputs"][i] * width)), 0))
            else:
                input.SetPosition(wx.Point(int(round(position.x*width / self.Size[0])), 0))
            input.MoveConnected()
        for i, output in enumerate(self.Outputs):
            position = output.GetRelPosition()
            if self.RealConnectors:
                output.SetPosition(wx.Point(int(round(self.RealConnectors["Outputs"][i] * width)), height))
            else:
                output.SetPosition(wx.Point(int(round(position.x*width / self.Size[0])), height))
            output.MoveConnected()
        self.Size = wx.Size(width, height)
        self.RefreshBoundingBox()

    # Returns the divergence minimum size 
开发者ID:thiagoralves,项目名称:OpenPLC_Editor,代码行数:22,代码来源:SFC_Objects.py

示例14: DrawHighlightment

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Point [as 别名]
def DrawHighlightment(self, dc):
        scalex, scaley = dc.GetUserScale()
        dc.SetUserScale(1, 1)
        dc.SetPen(MiterPen(HIGHLIGHTCOLOR))
        dc.SetBrush(wx.Brush(HIGHLIGHTCOLOR))
        dc.SetLogicalFunction(wx.AND)
        points = [wx.Point(int(round((self.Pos.x - 2) * scalex)) - 3,
                           int(round((self.Pos.y - 2) * scaley)) - 2),
                  wx.Point(int(round((self.Pos.x + self.Size[0] + 2) * scalex)) + 4,
                           int(round((self.Pos.y - 2) * scaley)) - 2),
                  wx.Point(int(round((self.Pos.x + self.Size[0] / 2) * scalex)),
                           int(round((self.Pos.y + self.Size[1] + 3) * scaley)) + 4)]
        dc.DrawPolygon(points)
        dc.SetLogicalFunction(wx.COPY)
        dc.SetUserScale(scalex, scaley)

    # Draws divergence 
开发者ID:thiagoralves,项目名称:OpenPLC_Editor,代码行数:19,代码来源:SFC_Objects.py

示例15: _create_NetworkEditor

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Point [as 别名]
def _create_NetworkEditor(self, prnt):
        self.NetworkEditor = wx.Panel(
            id=-1, parent=prnt, pos=wx.Point(0, 0),
            size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)

        NetworkEditorTemplate._init_ctrls(self, self.NetworkEditor)

        main_sizer = wx.FlexGridSizer(cols=1, hgap=0, rows=1, vgap=0)
        main_sizer.AddGrowableCol(0)
        main_sizer.AddGrowableRow(0)

        main_sizer.AddWindow(self.NetworkNodes, 0, border=5, flag=wx.GROW | wx.ALL)

        self.NetworkEditor.SetSizer(main_sizer)

        return self.NetworkEditor 
开发者ID:thiagoralves,项目名称:OpenPLC_Editor,代码行数:18,代码来源:NetworkEditor.py


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