How do I best get a full display screen window using wxPython?

Recommended Answers

All 5 Replies

A simple way would be to use wx.DisplaySize() as the size tuple of your frame ...

import wx
 
class Frame1(wx.Frame):
    def __init__(self):
    """
    create a frame, size is full display size, wx.DisplaySize()
    gives width, height tuple of display screen
    """
    wx.Frame.__init__(self, None, wx.ID_ANY, 'Full display size', pos=(0, 0), size=wx.DisplaySize())
    self.SetBackgroundColour('yellow')
    self.Show(True)
    print wx.DisplaySize() # test
 
 
application = wx.PySimpleApp()
# instantiate class
window = Frame1()
# event loop
application.MainLoop()

Works great, thank you!

I have a question to add to this. I have chosen wxPython for a project because im familiar with it. The question is this:

Is it possible to run wxPython frames in a 'kiosk' mode, whereby the frame takes up the whole viewable area of the user's screen, and he or she cannot see or touch the start bar?

To have the computer start up with this program I guess I could throw it on to the scheduled tasks, but im not sure that getting the frame to be truly 'fullscreen' is possible. Anyone run across a similar need or issue?

OK nevermind I just discovered that the wxFrame class has a method called ShowFullScreen(True). This will expand the frame to fit over the entire window.

OK nevermind I just discovered that the wxFrame class has a method called ShowFullScreen(True). This will expand the frame to fit over the entire window.

To be correct, there are some style options too ...

"""
wx.Frame has a ShowFullScreen method
strips all border decorations and buttons
(False restores original frame)
"""

myFrame.ShowFullScreen(True, style=wx.FULLSCREEN_ALL)
 
 
"""
list of partial style options:
wx.FULLSCREEN_NOMENUBAR 
wx.FULLSCREEN_NOTOOLBAR 
wx.FULLSCREEN_NOSTATUSBAR 
wx.FULLSCREEN_NOBORDER 
wx.FULLSCREEN_NOCAPTION 
wxFULLSCREEN_ALL
"""
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.