我们从Python开源项目中,提取了以下7个代码示例,用于说明如何使用wx.DisplaySize()。
def __init__(self, parent, id, title, size,style): self.parent = parent self.screenSize = wx.DisplaySize() #self.screenSize = [ 786, 768 ] self.screenWidth = int(self.screenSize[0] / 3) self.screenHeight = int(self.screenSize[1] / 2) #fontsy = wx.SystemSettings.GetFont(wx.SYS_SYSTEM_FONT).GetPixelSize() wx.Frame.__init__(self, parent, id, title, size=(400, 600), style=wx.DEFAULT_FRAME_STYLE) try: dosiero = open(os.path.join(os.path.expanduser("~"), '.config', 'stopgo.conf.json')) myprefs = json.load(dosiero) except: #print("No config found.") #DEBUG pass self.InitUI(myprefs) self.Show()
def getTaskbarPos(): d_w, d_h = wx.DisplaySize() c_x, c_y, c_w, c_h = wx.ClientDisplayRect() l = [(c_y, "top"), (d_h - c_y - c_h, "bottom"), (c_x, "left"), (d_w - c_x - c_w, "right")] def sorter(a,b): if a[0]<b[0] : return 1 if a[0]>b[0] : return -1 return 0 l.sort(sorter) return l[0][1]
def __init__(self): """Initialize the main GUI frame. """ # set frame size to reasonable value ##displaySize = [int(0.75*s) for s in wx.DisplaySize()] # hack to help on dual-screen, need something better XXX - idfah displaySize = wx.DisplaySize() displaySize = 1.2*displaySize[1], 0.75*displaySize[1] # call base class constructor wx.Frame.__init__(self, parent=None, title='CEBL3', size=displaySize) # initialize the main notebook self.initNotebook() # initialize the page and source manager self.mgr = Manager(pageParent=self.notebook, statusPanel=self) # add all pages to the notebook self.initNotebookPages() # initialize the status bar self.initStatusBar() # initialize the top-level layout self.initLayout() # cleanup when main frame is closed self.Bind(wx.EVT_CLOSE, self.close) # toggle full screen on EVT_FULLSCREEN events self.Bind(events.EVT_FULLSCREEN, self.toggleFullScreen) # update the status bar on EVT_UPDATE_STATUS events self.Bind(events.EVT_UPDATE_STATUS, self.updateStatusBar)
def __init__(self): screenSize = wx.DisplaySize() x = screenSize[0] y = screenSize[1]-80 wx.Frame.__init__(self, None, title="App Auto Viewer", size=(x-80,y)) self.panel = MainPanel(self) self.statusB = self.CreateStatusBar(number=2) global recordStatus recordStatus = "?" self.updateRecordStatus(recordStatus) self.statusB.SetStatusText("??? ???", 1)
def __init__(self, parent ): wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.Size(300,300), style = wx.TAB_TRAVERSAL ) self.initBuffer() self.bindEvents() self.scaleidx = 4 self.oldscale = 1 self.o = (0,0) self.reInitBuffer = True self.resized = True self.ips = None self.scrsize = wx.DisplaySize() self.s = 0
def __init__(self, parent): """Constructor""" wx.Panel.__init__(self, parent) width, height = wx.DisplaySize() self.picPaths = [] self.currentPicture = 0 self.totalPictures = 0 self.photoMaxSize = height - 200 Publisher().subscribe(self.updateImages, ("update images")) self.slideTimer = wx.Timer(None) self.slideTimer.Bind(wx.EVT_TIMER, self.update) self.layout()
def __init__(self, parent, id, title, style, clargs): if _plat.startswith('win'): HANDLER = logging.handlers.WatchedFileHandler(os.environ.get("LOGFILE", os.path.join(os.path.expanduser('~'), 'stopgo.log'))) else: HANDLER = logging.handlers.WatchedFileHandler(os.environ.get("LOGFILE", os.path.join('/','tmp','stopgo.log'))) FORMATTER = logging.Formatter(logging.BASIC_FORMAT) HANDLER.setFormatter(FORMATTER) if not clargs.has_key('verbose'): root = logging.getLogger() root.setLevel(os.environ.get("LOGLEVEL", "INFO")) root.addHandler(HANDLER) logging.exception("Debugging on.") #First retrieve the screen size of the device self.screenSize = wx.DisplaySize() self.framlog = 0 self.thumbsize = 180 self.camset = 0 self.prefdate = 0 prefstr = pref.PrefProbe().PrefGet() logging.exception(prefstr) logging.exception(type(prefstr)) self.myprefs = prefstr #self.myprefs = json.dumps(prefstr, sort_keys=True) #self.screenSize = [ 786, 768 ] self.screenWidth = int(self.screenSize[0]) self.screenHeight = int(self.screenSize[1]) #self.screenWidth = int(self.screenSize[0] / 3) #self.screenHeight = int(self.screenSize[1] / 1.5) self.hasSelected = False self.previous = 0 #fontsy = wx.SystemSettings.GetFont(wx.SYS_SYSTEM_FONT).GetPixelSize() wx.Frame.__init__(self, parent, id, title, size=(self.screenWidth, self.screenHeight), style=wx.DEFAULT_FRAME_STYLE) self.timer = wx.Timer(self, ID_TIMER) self.blick = 0 self.Bind(wx.EVT_TIMER, self.OnTimer, id=ID_TIMER) self.Bind(wx.EVT_CHAR_HOOK, lambda event, args=(True, ):self.OnKeyDown(event, args)) self.clargs = clargs logging.exception(prefstr) self.InitUI()