我们从Python开源项目中,提取了以下4个代码示例,用于说明如何使用wx.PlatformInfo()。
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)
def OnMovePost(self, dc, x, y, oldX, oldY, display): shape = self.GetShape() ogl.ShapeEvtHandler.OnMovePost(self, dc, x, y, oldX, oldY, display) self.callback() if "wxMac" in wx.PlatformInfo: shape.GetCanvas().Refresh(False)
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
def _SizeWindows(self): #print '\n_SizeWindows', self.GetSize(), self.GetParent().GetSize(), self.GetClientSize() if not self._windows: return if len(self.get_windows_shown()) == 0: return largUtil = self._LarguraUtil() if self._GetFit(): usado = 0 for idx, spos in enumerate(self._sashes): # #print '_sash fit:', idx, spos if idx < len(self._sashes)-1: self._sashes[idx] = round(self._proporcao[idx] * largUtil) usado += round(self._proporcao[idx] * largUtil) else: self._sashes[idx] = largUtil - usado border = self._border_size sash = self._sash_size if 'wxMSW' in wx.PlatformInfo: self.Freeze() x = y = border h = self.GetClientSize().GetHeight() - (2 * border) for idx, spos in enumerate(self._sashes): ##print ' _sash:', idx, spos window = self.GetWindow(idx) if window.IsShown(): #print 'window.SetSize({}, {}, {}, {})'.format(x, y, spos, h) window.SetSize(x, y, spos, h) ##print ' {} - SetDimensions({}, {}, {}, {})'.format(window._view._controller_uid, x, y, spos, h) #for panel in window.selectedCanvas: # panel.Refresh() #self._draw_window_selection(window) x += spos + sash if 'wxMSW' in wx.PlatformInfo: self.Thaw() self._DrawSashes() self._DrawBorders() # self._needUpdating = False ##print