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


Python wx.PlatformInfo方法代码示例

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


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

示例1: version

# 需要导入模块: import wx [as 别名]
# 或者: from wx import PlatformInfo [as 别名]
def version():
    """
    Returns a string containing version and port info
    """
    if wx.Port == '__WXMSW__':
        port = 'msw'
    elif wx.Port == '__WXMAC__':
        if 'wxOSX-carbon' in wx.PlatformInfo:
            port = 'osx-carbon'
        else:
            port = 'osx-cocoa'
    elif wx.Port == '__WXGTK__':
        port = 'gtk'
        if 'gtk2' in wx.PlatformInfo:
            port = 'gtk2'
        elif 'gtk3' in wx.PlatformInfo:
            port = 'gtk3'
    else:
        port = '???'
    return "%s %s (phoenix)" % (wx.VERSION_STRING, port) 
开发者ID:dougthor42,项目名称:wafer_map,代码行数:22,代码来源:core.py

示例2: LeftDown

# 需要导入模块: import wx [as 别名]
# 或者: from wx import PlatformInfo [as 别名]
def LeftDown(self, event):
        i = self._resolve_index()
        if i is None:
            return

        if not event.ControlDown():
            if event.ShiftDown():
                if '__WXMSW__' in wx.PlatformInfo:
                    self.listctrl.DeselectAll()
                f = self.listctrl.GetFocusedItem()
                if f > -1:
                    for j in xrange(min(i,f), max(i,f)):
                        self.listctrl.Select(j)
                    self.listctrl.Select(f)
            else:
                self.listctrl.DeselectAll()

        self.listctrl.Select(i)
        self.listctrl.SetFocus()
        self.listctrl.Focus(i) 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:22,代码来源:CustomWidgets.py

示例3: _get_origin_offset

# 需要导入模块: import wx [as 别名]
# 或者: from wx import PlatformInfo [as 别名]
def _get_origin_offset(self, include_header=None):

        if include_header is None:
            # Hm, I think this is a legit bug in wxGTK
            if '__WXGTK__' in wx.PlatformInfo:
                include_header = True
            else:
                include_header = False

        if include_header:            
            i = self.GetTopItem()
            try:
                r = self.GetItemRect(i)
            except wx._core.PyAssertionError:
                r = self.default_rect
            return (r.x, r.y)
        return (0, 0) 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:19,代码来源:ListCtrl.py

示例4: on_Cancel

# 需要导入模块: import wx [as 别名]
# 或者: from wx import PlatformInfo [as 别名]
def on_Cancel(self, event):

        #----------------------------------------
        #  Event handler for the Cancel button.
        #----------------------------------------
        self.Destroy()

    #   on_Cancel()
    #----------------------------------------------------------------
        
#-----------------------------------------
#  Class for displaying HTML help
#  (now using webbrowser module instead).
#-----------------------------------------        
##class HTML_Help_Window(wx.Frame):
##    def __init__(self, parent, title, html_file):
##        wx.Frame.__init__(self, parent, -1, title,
##                          size=(700,800), pos=(600,50))
##        html = wx.html.HtmlWindow(self)
##        if "gtk2" in wx.PlatformInfo:
##            html.SetStandardFonts()
##
##        html.LoadPage(html_file)

#------------------------------------------------------------- 
开发者ID:peckhams,项目名称:topoflow,代码行数:27,代码来源:Input_Dialog_LAST.py

示例5: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import PlatformInfo [as 别名]
def __init__(self, parent):
        wx.Dialog.__init__(self, parent, wx.ID_ANY, "About NodeMCU PyFlasher")
        html = HtmlWindow(self, wx.ID_ANY, size=(420, -1))
        if "gtk2" in wx.PlatformInfo or "gtk3" in wx.PlatformInfo:
            html.SetStandardFonts()
        txt = self.text.format(self._get_bundle_dir(), __version__)
        html.SetPage(txt)
        ir = html.GetInternalRepresentation()
        html.SetSize((ir.GetWidth() + 25, ir.GetHeight() + 25))
        self.SetClientSize(html.GetSize())
        self.CentreOnParent(wx.BOTH) 
开发者ID:marcelstoer,项目名称:nodemcu-pyflasher,代码行数:13,代码来源:About.py

示例6: draw_rubberband

# 需要导入模块: import wx [as 别名]
# 或者: from wx import PlatformInfo [as 别名]
def draw_rubberband(self, event, x0, y0, x1, y1):
        # Use an Overlay to draw a rubberband-like bounding box.

        dc = wx.ClientDC(self.canvas)
        odc = wx.DCOverlay(self.wxoverlay, dc)
        odc.Clear()

        # Mac's DC is already the same as a GCDC, and it causes
        # problems with the overlay if we try to use an actual
        # wx.GCDC so don't try it.
        if 'wxMac' not in wx.PlatformInfo:
            dc = wx.GCDC(dc)

        height = self.canvas.figure.bbox.height
        y1 = height - y1
        y0 = height - y0

        if y1<y0: y0, y1 = y1, y0
        if x1<y0: x0, x1 = x1, x0

        w = x1 - x0
        h = y1 - y0
        rect = wx.Rect(x0, y0, w, h)

        rubberBandColor = '#C0C0FF' # or load from config?

        # Set a pen for the border
        color = wx.NamedColour(rubberBandColor)
        dc.SetPen(wx.Pen(color, 1))

        # use the same color, plus alpha for the brush
        r, g, b = color.Get()
        color.Set(r,g,b, 0x60)
        dc.SetBrush(wx.Brush(color))
        dc.DrawRectangleRect(rect) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:37,代码来源:backend_wx.py

示例7: CreateHTMLCtrl

# 需要导入模块: import wx [as 别名]
# 或者: from wx import PlatformInfo [as 别名]
def CreateHTMLCtrl(self):
        ctrl = wx.html.HtmlWindow(self, -1, wx.DefaultPosition, wx.Size(400, 300))
        if "gtk2" in wx.PlatformInfo or "gtk3" in wx.PlatformInfo:
            ctrl.SetStandardFonts()

        ctrl.SetPage("")

        return ctrl 
开发者ID:xmendez,项目名称:wfuzz,代码行数:10,代码来源:guicontrols.py

示例8: load_geometry

# 需要导入模块: import wx [as 别名]
# 或者: from wx import PlatformInfo [as 别名]
def load_geometry(self, geometry, default_size=None):
        if '+' in geometry:
            s, x, y = geometry.split('+')
            x, y = int(x), int(y)
        else:
            x, y = -1, -1
            s = geometry

        if 'x' in s:
            w, h = s.split('x')
            w, h = int(w), int(h)
        else:
            w, h = -1, -1

        i = 0
        if '__WXMSW__' in wx.PlatformInfo:
            i = wx.Display.GetFromWindow(self)
        d = wx.Display(i)
        (x1, y1, x2, y2) = d.GetGeometry()
        x = min(x, x2-64)
        y = min(y, y2-64)

        if (w, h) <= (0, 0) and default_size is not None:
            w = default_size.width
            h = default_size.height

        self.SetDimensions(x, y, w, h, sizeFlags=wx.SIZE_USE_EXISTING)

        if (x, y) == (-1, -1):
            self.CenterOnScreen() 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:32,代码来源:__init__.py

示例9: OnEraseBackground

# 需要导入模块: import wx [as 别名]
# 或者: from wx import PlatformInfo [as 别名]
def OnEraseBackground(self, event=None):
        nsp = self.GetScrollPos(wx.VERTICAL)
        if self._last_scrollpos != nsp:
            self._last_scrollpos = nsp
            # should only refresh visible items, hmm
            wx.CallAfter(self.Refresh)
        dc = wx.ClientDC(self)
        # erase the section of the background which is not covered by the
        # items or the selected column highlighting
        dc.SetBackground(wx.Brush(self.GetBackgroundColour()))
        f = self.GetRect()
        r = wx.Region(0, 0, f.width, f.height)
        x = self.GetVisibleViewRect()
        offset = self._get_origin_offset(include_header=True)
        x.Offset(offset)
        r.SubtractRect(x)
        if '__WXMSW__' in wx.PlatformInfo:
            c = self.GetColumnRect(self.enabled_columns.index(self.selected_column))
            r.SubtractRect(c)
        dc.SetClippingRegionAsRegion(r)
        dc.Clear()

        if '__WXMSW__' in wx.PlatformInfo:
            # draw the selected column highlighting under the items
            dc.DestroyClippingRegion()
            r = wx.Region(0, 0, f.width, f.height)
            r.SubtractRect(x)
            dc.SetClippingRegionAsRegion(r)
            dc.SetPen(wx.TRANSPARENT_PEN)
            hc = wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW)
            r = highlight_color(hc.Red())
            g = highlight_color(hc.Green())
            b = highlight_color(hc.Blue())
            hc.Set(r, g, b)
            dc.SetBrush(wx.Brush(hc))
            dc.DrawRectangle(c.x, c.y, c.width, c.height) 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:38,代码来源:ListCtrl.py

示例10: rize_up

# 需要导入模块: import wx [as 别名]
# 或者: from wx import PlatformInfo [as 别名]
def rize_up(self):
        if not self.main_window.IsShown():
            self.main_window.Show(True)
            self.main_window.Iconize(False)
        if '__WXGTK__' not in wx.PlatformInfo:
            # this plays havoc with multiple virtual desktops
            self.main_window.Raise() 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:9,代码来源:DownloadManager.py

示例11: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import PlatformInfo [as 别名]
def __init__(self, parent=None):
        wx.Dialog.__init__(self, parent, -1, _('About wxGlade'))
        html = wx.html.HtmlWindow(self, -1, size=(480, 250))
        html.Bind(wx.html.EVT_HTML_LINK_CLICKED, self.OnLinkClicked)
        # it's recommended at least for GTK2 based wxPython
        if "gtk2" in wx.PlatformInfo:
            html.SetStandardFonts()
        bgcolor = misc.color_to_string(self.GetBackgroundColour())
        icon_path = os.path.join(config.icons_path, 'wxglade_small.png')
        html.SetPage( self.text % (bgcolor, icon_path, config.version, config.py_version, config.wx_version) )
        ir = html.GetInternalRepresentation()
        ir.SetIndent(0, wx.html.HTML_INDENT_ALL)
        html.SetSize((ir.GetWidth(), ir.GetHeight()))
        szr = wx.BoxSizer(wx.VERTICAL)
        szr.Add(html, 0, wx.TOP|wx.ALIGN_CENTER, 10)
        szr.Add(wx.StaticLine(self, -1), 0, wx.LEFT|wx.RIGHT|wx.EXPAND, 20)
        szr2 = wx.BoxSizer(wx.HORIZONTAL)
        btn = wx.Button(self, wx.ID_OK, _("OK"))
        btn.SetDefault()
        szr2.Add(btn)
        if wx.Platform == '__WXGTK__':
            extra_border = 5  # border around a default button
        else:
            extra_border = 0
        szr.Add(szr2, 0, wx.ALL|wx.ALIGN_RIGHT, 20 + extra_border)
        self.SetAutoLayout(True)
        self.SetSizer(szr)
        szr.Fit(self)
        self.Layout()
        if parent: self.CenterOnParent()
        else: self.CenterOnScreen() 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:33,代码来源:about.py

示例12: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import PlatformInfo [as 别名]
def __init__(self, parent):
        title = "Resize the dialog and see how controls adapt!"
        wx.Dialog.__init__(self, parent, -1, title,
                           style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER)

        notebook = wx.Notebook(self, -1, size=(450,300))
        panel1 = wx.Panel(notebook)
        panel2 = wx.Panel(notebook)
        notebook.AddPage(panel1, "Panel 1")
        notebook.AddPage(panel2, "Panel 2")

        dialog_sizer = wx.BoxSizer(wx.VERTICAL)
        dialog_sizer.Add(notebook, 1, wx.EXPAND|wx.ALL, 5)

        panel1_sizer = wx.BoxSizer(wx.VERTICAL)
        text = wx.TextCtrl(panel1, -1, "Hi!", size=(400,90), style=wx.TE_MULTILINE)
        button1 = wx.Button(panel1, -1, "I only resize horizontally...")
        panel1_sizer.Add(text, 1, wx.EXPAND|wx.ALL, 10)
        panel1_sizer.Add(button1, 0, wx.EXPAND|wx.ALL, 10)
        panel1.SetSizer(panel1_sizer)

        panel2_sizer = wx.BoxSizer(wx.HORIZONTAL)
        button2 = wx.Button(panel2, -1, "I resize vertically")
        button3 = wx.Button(panel2, -1, "I don't like resizing!")
        panel2_sizer.Add(button2, 0, wx.EXPAND|wx.ALL, 20)
        panel2_sizer.Add(button3, 0, wx.ALL, 100)
        panel2.SetSizer(panel2_sizer)

        if "__WXMAC__" in wx.PlatformInfo:
           self.SetSizer(dialog_sizer)
        else:
           self.SetSizerAndFit(dialog_sizer)
        self.Centre()

        self.Bind(wx.EVT_BUTTON, self.OnButton) 
开发者ID:peckhams,项目名称:topoflow,代码行数:37,代码来源:Notebook2.py

示例13: MakeIcon

# 需要导入模块: import wx [as 别名]
# 或者: from wx import PlatformInfo [as 别名]
def MakeIcon(self, img):
        """
        The various platforms have different requirements for the
        icon size...
        """
        if "wxMSW" in wx.PlatformInfo:
            img = img.Scale(16, 16)
        elif "wxGTK" in wx.PlatformInfo:
            img = img.Scale(22, 22)
        # wxMac can be any size upto 128x128, so leave the source img alone....
        icon = wx.IconFromBitmap(img.ConvertToBitmap() )
        return icon 
开发者ID:peckhams,项目名称:topoflow,代码行数:14,代码来源:Dock_Bar_Example.py

示例14: MakeIcon

# 需要导入模块: import wx [as 别名]
# 或者: from wx import PlatformInfo [as 别名]
def MakeIcon(self, img):
                """
                The various platforms have different requirements for the
                icon size...
                """
                if "wxMSW" in wx.PlatformInfo:
                    img = img.Scale(16, 16)
                elif "wxGTK" in wx.PlatformInfo:
                    img = img.Scale(22, 22)
                # wxMac can be any size upto 128x128, so leave the source img alone....
                icon = wx.IconFromBitmap(img.ConvertToBitmap())
                return icon 
开发者ID:thiagoralves,项目名称:OpenPLC_Editor,代码行数:14,代码来源:Beremiz_service.py

示例15: OnLoadFile

# 需要导入模块: import wx [as 别名]
# 或者: from wx import PlatformInfo [as 别名]
def OnLoadFile(self, event):
        wildcard_str = ""
        if wx.PlatformInfo[4] != "wxOSX-cocoa":
            from iotbx import file_reader

            wildcard_str = file_reader.get_wildcard_string("img")
        file_name = wx.FileSelector(
            "Image file",
            wildcard=wildcard_str,
            default_path="",
            flags=(wx.OPEN if WX3 else wx.FD_OPEN),
        )
        if file_name != "":
            self.load_image(file_name) 
开发者ID:dials,项目名称:dials,代码行数:16,代码来源:rstbx_frame.py


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