WindowProperties

from panda3d.core import WindowProperties
class WindowProperties

Bases:

A container for the various kinds of properties we might ask to have on a graphics window before we open it. This also serves to hold the current properties for a window after it has been opened.

Inheritance diagram

Inheritance diagram of WindowProperties

enum MouseMode
enumerator M_absolute = 0
enumerator M_relative = 1
enumerator M_confined = 2
enum ZOrder
enumerator Z_bottom = 0
enumerator Z_normal = 1
enumerator Z_top = 2
__eq__(other: WindowProperties) bool
__init__(args: object, kwds: object)
__ne__(other: WindowProperties) bool
addProperties(other: WindowProperties)

Sets any properties that are explicitly specified in other on this object. Leaves other properties unchanged.

assign(copy: WindowProperties) WindowProperties
clear()

Unsets all properties that have been specified so far, and resets the WindowProperties structure to its initial empty state.

clearCursorFilename()

Removes the cursor_filename specification from the properties.

clearCursorHidden()

Removes the cursor_hidden specification from the properties.

static clearDefault()

Returns the “default” WindowProperties to whatever is specified in the user’s config file.

clearFixedSize()

Removes the fixed_size specification from the properties.

clearForeground()

Removes the foreground specification from the properties.

clearFullscreen()

Removes the fullscreen specification from the properties.

clearIconFilename()

Removes the icon_filename specification from the properties.

clearMinimized()

Removes the minimized specification from the properties.

clearMouseMode()

Removes the mouse_mode specification from the properties.

clearOpen()

Removes the open specification from the properties.

clearOrigin()

Removes the origin specification from the properties.

clearParentWindow()

Removes the S_parent_window specification from the properties.

clearRawMice()

Removes the raw_mice specification from the properties.

clearSize()

Removes the size specification from the properties.

clearTitle()

Removes the title specification from the properties.

clearUndecorated()

Removes the undecorated specification from the properties.

clearZOrder()

Removes the z_order specification from the properties.

property config_properties WindowProperties

Returns a WindowProperties structure with all of the default values filled in according to the user’s config file.

property cursor_filename Filename
Getter

Returns the icon filename associated with the mouse cursor.

Setter

Specifies the file that contains the icon to associate with the mouse cursor when it is within the window (and visible).

property cursor_hidden bool
Getter

Returns true if the mouse cursor is invisible.

Setter

Specifies whether the mouse cursor should be visible.

property default WindowProperties
Getter

Returns the “default” WindowProperties. If setDefault() has been called, this returns that WindowProperties structure; otherwise, this returns getConfigProperties().

Setter

Replaces the “default” WindowProperties with the specified structure. The specified WindowProperties will be returned by future calls to getDefault(), until clearDefault() is called.

Note that this completely replaces the default properties; it is not additive.

property fixed_size bool
Getter

Returns true if the window cannot be resized by the user, false otherwise.

Setter

Specifies whether the window should be resizable by the user.

property foreground bool
Getter

Returns true if the window is in the foreground.

Setter

Specifies whether the window should be opened in the foreground (true), or left in the background (false).

property fullscreen bool
Getter

Returns true if the window is in fullscreen mode.

Setter

Specifies whether the window should be opened in fullscreen mode (true) or normal windowed mode (false, the default).

static getConfigProperties() WindowProperties

Returns a WindowProperties structure with all of the default values filled in according to the user’s config file.

getCursorFilename() Filename

Returns the icon filename associated with the mouse cursor.

getCursorHidden() bool

Returns true if the mouse cursor is invisible.

static getDefault() WindowProperties

Returns the “default” WindowProperties. If setDefault() has been called, this returns that WindowProperties structure; otherwise, this returns getConfigProperties().

getFixedSize() bool

Returns true if the window cannot be resized by the user, false otherwise.

getForeground() bool

Returns true if the window is in the foreground.

getFullscreen() bool

Returns true if the window is in fullscreen mode.

getIconFilename() Filename

Returns the icon filename associated with the window.

getMinimized() bool

Returns true if the window is minimized.

getMouseMode() MouseMode

See setMouseMode().

getOpen() bool

Returns true if the window is open.

getOrigin() LPoint2i

Returns the coordinates of the window’s top-left corner, not including decorations.

getParentWindow() WindowHandle

Returns the parent window specification, or NULL if there is no parent window specified.

getRawMice() bool

Returns true if the window reads the raw mice.

getSize() LVector2i

Returns size in pixels of the useful part of the window, not including decorations.

getTitle() str

Returns the window’s title.

getUndecorated() bool

Returns true if the window has no border.

getXOrigin() int

Returns the x coordinate of the window’s top-left corner, not including decorations.

getXSize() int

Returns size in pixels in the x dimension of the useful part of the window, not including decorations. That is, this is the window’s width.

getYOrigin() int

Returns the y coordinate of the window’s top-left corner, not including decorations.

getYSize() int

Returns size in pixels in the y dimension of the useful part of the window, not including decorations. That is, this is the window’s height.

getZOrder() ZOrder

Returns the window’s z_order.

hasCursorFilename() bool

Returns true if setCursorFilename() has been specified.

hasCursorHidden() bool

Returns true if setCursorHidden() has been specified.

hasFixedSize() bool

Returns true if setFixedSize() has been specified.

hasForeground() bool

Returns true if setForeground() has been specified.

hasFullscreen() bool

Returns true if setFullscreen() has been specified.

hasIconFilename() bool

Returns true if setIconFilename() has been specified.

hasMinimized() bool

Returns true if setMinimized() has been specified.

hasMouseMode() bool
hasOpen() bool

Returns true if setOpen() has been specified.

hasOrigin() bool

Returns true if the window origin has been specified, false otherwise.

hasParentWindow() bool

Checks the S_parent_window specification from the properties.

hasRawMice() bool

Returns true if setRawMice() has been specified.

hasSize() bool

Returns true if the window size has been specified, false otherwise.

hasTitle() bool

Returns true if the window title has been specified, false otherwise.

hasUndecorated() bool

Returns true if setUndecorated() has been specified.

hasZOrder() bool

Returns true if the window z_order has been specified, false otherwise.

property icon_filename Filename
Getter

Returns the icon filename associated with the window.

Setter

Specifies the file that contains the icon to associate with the window when it is minimized.

isAnySpecified() bool

Returns true if any properties have been specified, false otherwise.

property minimized bool
Getter

Returns true if the window is minimized.

Setter

Specifies whether the window should be created minimized (true), or normal (false).

property mouse_mode MouseMode

Specifies the mode in which the window is to operate its mouse pointer.

M_absolute: the normal mode in which a mouse pointer operates, where the mouse can move outside the window and the mouse coordinates are relative to its position in the window.

M_relative (OSX or Unix/X11 only): a mode where only relative movements are reported; particularly useful for FPS-style mouse movements where you have hidden the mouse pointer and are are more interested in how fast the mouse is moving, rather than precisely where the pointer is hovering.

This has no effect on Windows. On Unix/X11, this requires the Xxf86dga extension to be available.

M_confined: this mode reports absolute mouse positions, but confines the mouse pointer to the window boundary. It can portably replace M_relative for an FPS, but you need to periodically move the pointer to the center of the window and track movement deltas.

property open bool
Getter

Returns true if the window is open.

Setter

Specifies whether the window should be open. It is legal to create a GraphicsWindow in the closed state, and later request it to open by changing this flag.

property origin LPoint2i
Getter

Returns the coordinates of the window’s top-left corner, not including decorations.

Setter

Specifies the origin on the screen (in pixels, relative to the top-left corner) at which the window should appear. This is the origin of the top- left corner of the useful part of the window, not including decorations.

Specifies the origin on the screen (in pixels, relative to the top-left corner) at which the window should appear. This is the origin of the top- left corner of the useful part of the window, not including decorations.

output(out: ostream)

Sets any properties that are explicitly specified in other on this object. Leaves other properties unchanged.

property parent_window WindowHandle
Getter

Returns the parent window specification, or NULL if there is no parent window specified.

Setter

Specifies the window that this window should be attached to. If this is NULL or unspecified, the window will be created as a toplevel window on the desktop; if this is non-NULL, the window will be bound as a child window to the indicated parent window.

You should use GraphicsPipe::make_window_handle() to create an instance of a WindowHandle object given an appropriate OS-specific window handle representation. Each OS-specific GraphicsPipe class defines a make_window_handle() method that returns an appropriate WindowHandle object to wrap the particular OS-specific representation.

Specifies the window that this window should be attached to.

This is a deprecated variant on this method, and exists only for backward compatibility. Future code should use the version of setParentWindow() below that receives a WindowHandle object; that interface is much more robust.

In this deprecated variant, the actual value for “parent” is platform- specific. On Windows, it is the HWND of the parent window, cast to an unsigned integer. On X11, it is the Window pointer of the parent window, similarly cast. On OSX, this is the NSWindow pointer, which doesn’t appear to work at all.

setCursorFilename(cursor_filename: Filename)

Specifies the file that contains the icon to associate with the mouse cursor when it is within the window (and visible).

setCursorHidden(cursor_hidden: bool)

Specifies whether the mouse cursor should be visible.

static setDefault(default_properties: WindowProperties)

Replaces the “default” WindowProperties with the specified structure. The specified WindowProperties will be returned by future calls to getDefault(), until clearDefault() is called.

Note that this completely replaces the default properties; it is not additive.

setFixedSize(fixed_size: bool)

Specifies whether the window should be resizable by the user.

setForeground(foreground: bool)

Specifies whether the window should be opened in the foreground (true), or left in the background (false).

setFullscreen(fullscreen: bool)

Specifies whether the window should be opened in fullscreen mode (true) or normal windowed mode (false, the default).

setIconFilename(icon_filename: Filename)

Specifies the file that contains the icon to associate with the window when it is minimized.

setMinimized(minimized: bool)

Specifies whether the window should be created minimized (true), or normal (false).

setMouseMode(mode: MouseMode)

Specifies the mode in which the window is to operate its mouse pointer.

M_absolute: the normal mode in which a mouse pointer operates, where the mouse can move outside the window and the mouse coordinates are relative to its position in the window.

M_relative (OSX or Unix/X11 only): a mode where only relative movements are reported; particularly useful for FPS-style mouse movements where you have hidden the mouse pointer and are are more interested in how fast the mouse is moving, rather than precisely where the pointer is hovering.

This has no effect on Windows. On Unix/X11, this requires the Xxf86dga extension to be available.

M_confined: this mode reports absolute mouse positions, but confines the mouse pointer to the window boundary. It can portably replace M_relative for an FPS, but you need to periodically move the pointer to the center of the window and track movement deltas.

setOpen(open: bool)

Specifies whether the window should be open. It is legal to create a GraphicsWindow in the closed state, and later request it to open by changing this flag.

setOrigin(origin: LPoint2i)

Specifies the origin on the screen (in pixels, relative to the top-left corner) at which the window should appear. This is the origin of the top- left corner of the useful part of the window, not including decorations.

setOrigin(x_origin: int, y_origin: int)

Specifies the origin on the screen (in pixels, relative to the top-left corner) at which the window should appear. This is the origin of the top- left corner of the useful part of the window, not including decorations.

setParentWindow(parent_window: WindowHandle)

Specifies the window that this window should be attached to. If this is NULL or unspecified, the window will be created as a toplevel window on the desktop; if this is non-NULL, the window will be bound as a child window to the indicated parent window.

You should use GraphicsPipe::make_window_handle() to create an instance of a WindowHandle object given an appropriate OS-specific window handle representation. Each OS-specific GraphicsPipe class defines a make_window_handle() method that returns an appropriate WindowHandle object to wrap the particular OS-specific representation.

setParentWindow(parent: int)

Specifies the window that this window should be attached to.

This is a deprecated variant on this method, and exists only for backward compatibility. Future code should use the version of setParentWindow() below that receives a WindowHandle object; that interface is much more robust.

In this deprecated variant, the actual value for “parent” is platform- specific. On Windows, it is the HWND of the parent window, cast to an unsigned integer. On X11, it is the Window pointer of the parent window, similarly cast. On OSX, this is the NSWindow pointer, which doesn’t appear to work at all.

setRawMice(raw_mice: bool)

Specifies whether the window should read the raw mouse devices.

setSize(size: LVector2i)

Specifies the requested size of the window, in pixels. This is the size of the useful part of the window, not including decorations.

setSize(x_size: int, y_size: int)

Specifies the requested size of the window, in pixels. This is the size of the useful part of the window, not including decorations.

setTitle(title: str)

Specifies the title that should be assigned to the window.

setUndecorated(undecorated: bool)

Specifies whether the window should be created with a visible title and border (false, the default) or not (true).

setZOrder(z_order: ZOrder)

Specifies the relative ordering of the window with respect to other windows. If the z_order is Z_top, the window will always be on top of other windows; if it is Z_bottom, it will always be below other windows. Most windows will want to be Z_normal, which allows the user to control the order.

static size(size: LVecBase2i) WindowProperties

Returns a WindowProperties structure with only the size specified. The size is the only property that matters to buffers.

Deprecated: in the Python API, use WindowProperties(size=(x, y)) instead.

static size(x_size: int, y_size: int) WindowProperties
property size LVector2i
Getter

Returns size in pixels of the useful part of the window, not including decorations.

Setter

Specifies the requested size of the window, in pixels. This is the size of the useful part of the window, not including decorations.

Specifies the requested size of the window, in pixels. This is the size of the useful part of the window, not including decorations.

property title string
Getter

Returns the window’s title.

Setter

Specifies the title that should be assigned to the window.

property undecorated bool
Getter

Returns true if the window has no border.

Setter

Specifies whether the window should be created with a visible title and border (false, the default) or not (true).

property z_order ZOrder
Getter

Returns the window’s z_order.

Setter

Specifies the relative ordering of the window with respect to other windows. If the z_order is Z_top, the window will always be on top of other windows; if it is Z_bottom, it will always be below other windows. Most windows will want to be Z_normal, which allows the user to control the order.