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
- __eq__(other: WindowProperties) bool
- __ne__(other: WindowProperties) bool
- add_properties(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.
- clear_cursor_filename()
Removes the cursor_filename specification from the properties.
Removes the cursor_hidden specification from the properties.
- static clear_default()
Returns the “default”
WindowProperties
to whatever is specified in the user’s config file.
- clear_fixed_size()
Removes the fixed_size specification from the properties.
- clear_foreground()
Removes the foreground specification from the properties.
- clear_fullscreen()
Removes the fullscreen specification from the properties.
- clear_icon_filename()
Removes the icon_filename specification from the properties.
- clear_maximized()
Removes the maximized specification from the properties.
- clear_minimized()
Removes the minimized specification from the properties.
- clear_mouse_mode()
Removes the mouse_mode specification from the properties.
- clear_open()
Removes the open specification from the properties.
- clear_origin()
Removes the origin specification from the properties.
- clear_parent_window()
Removes the S_parent_window specification from the properties.
- clear_raw_mice()
Removes the raw_mice specification from the properties.
- clear_size()
Removes the size specification from the properties.
- clear_title()
Removes the title specification from the properties.
- clear_undecorated()
Removes the undecorated specification from the properties.
- clear_z_order()
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).
- 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
. Ifset_default()
has been called, this returns thatWindowProperties
structure; otherwise, this returnsget_config_properties()
.- Setter
Replaces the “default”
WindowProperties
with the specified structure. The specifiedWindowProperties
will be returned by future calls toget_default()
, untilclear_default()
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 get_config_properties() WindowProperties
Returns a
WindowProperties
structure with all of the default values filled in according to the user’s config file.
Returns true if the mouse cursor is invisible.
- static get_default() WindowProperties
Returns the “default”
WindowProperties
. Ifset_default()
has been called, this returns thatWindowProperties
structure; otherwise, this returnsget_config_properties()
.
- get_mouse_mode() MouseMode
See
set_mouse_mode()
.
- get_origin() LPoint2i
Returns the coordinates of the window’s top-left corner, not including decorations.
- get_parent_window() WindowHandle
Returns the parent window specification, or NULL if there is no parent window specified.
- get_size() LVector2i
Returns size in pixels of the useful part of the window, not including decorations.
- get_x_origin() int
Returns the x coordinate of the window’s top-left corner, not including decorations.
- get_x_size() 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.
- get_y_origin() int
Returns the y coordinate of the window’s top-left corner, not including decorations.
- get_y_size() 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.
- get_z_order() ZOrder
Returns the window’s z_order.
- has_cursor_filename() bool
Returns true if
set_cursor_filename()
has been specified.
Returns true if
set_cursor_hidden()
has been specified.
- has_fixed_size() bool
Returns true if
set_fixed_size()
has been specified.
- has_foreground() bool
Returns true if
set_foreground()
has been specified.
- has_fullscreen() bool
Returns true if
set_fullscreen()
has been specified.
- has_icon_filename() bool
Returns true if
set_icon_filename()
has been specified.
- has_maximized() bool
Returns true if
set_maximized()
has been specified.
- has_minimized() bool
Returns true if
set_minimized()
has been specified.
- has_open() bool
Returns true if
set_open()
has been specified.
- has_raw_mice() bool
Returns true if
set_raw_mice()
has been specified.
- has_undecorated() bool
Returns true if
set_undecorated()
has been specified.
- 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.
- property maximized bool
- Getter
Returns true if the window is maximized.
- Setter
Specifies whether the window should be created maximized (true), or normal (false).
- 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_confined: this mode reports absolute mouse positions, but confines the mouse pointer to the window boundary. The reported mouse positions will never be outside of the window boundary.
M_relative: 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. The reported positions still appear to be absolute, but they can go toward negative or positive infinity without being constrained by the window (or screen) dimensions. Since the position of the mouse cursor becomes meaningless in this mode, it is recommended to combine this with the cursor_hidden flag.
- 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-specificGraphicsPipe
class defines a make_window_handle() method that returns an appropriateWindowHandle
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
set_parent_window()
below that receives aWindowHandle
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.
- set_cursor_filename(cursor_filename: Filename)
Specifies the file that contains the icon to associate with the mouse cursor when it is within the window (and visible).
Specifies whether the mouse cursor should be visible.
- static set_default(default_properties: WindowProperties)
Replaces the “default”
WindowProperties
with the specified structure. The specifiedWindowProperties
will be returned by future calls toget_default()
, untilclear_default()
is called.Note that this completely replaces the default properties; it is not additive.
- set_foreground(foreground: bool)
Specifies whether the window should be opened in the foreground (true), or left in the background (false).
- set_fullscreen(fullscreen: bool)
Specifies whether the window should be opened in fullscreen mode (true) or normal windowed mode (false, the default).
- set_icon_filename(icon_filename: Filename)
Specifies the file that contains the icon to associate with the window when it is minimized.
- set_maximized(maximized: bool)
Specifies whether the window should be created maximized (true), or normal (false).
- set_minimized(minimized: bool)
Specifies whether the window should be created minimized (true), or normal (false).
- set_mouse_mode(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_confined: this mode reports absolute mouse positions, but confines the mouse pointer to the window boundary. The reported mouse positions will never be outside of the window boundary.
M_relative: 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. The reported positions still appear to be absolute, but they can go toward negative or positive infinity without being constrained by the window (or screen) dimensions. Since the position of the mouse cursor becomes meaningless in this mode, it is recommended to combine this with the cursor_hidden flag.
- set_open(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.
- set_origin(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.
- set_origin(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.
- set_parent_window(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-specificGraphicsPipe
class defines a make_window_handle() method that returns an appropriateWindowHandle
object to wrap the particular OS-specific representation.
- set_parent_window(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 set_parent_window() 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.
- set_size(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.
- set_size(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.
- set_undecorated(undecorated: bool)
Specifies whether the window should be created with a visible title and border (false, the default) or not (true).
- set_z_order(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.