| Home | Trees | Index | Help |
|
|---|
| Package wx :: Class Window |
|
object--+ |Object--+ |EvtHandler--+ | Window
Canvas,
CaptionBar,
ColDragWindow,
Control,
DynamicSashWindow,
EmptyChild,
GLCanvas,
HtmlHelpWindow,
ImageView,
MDIClientWindow,
MenuBar,
MultiClient,
MultiCloser,
MultiCreator,
MultiSash,
MultiSizer,
MultiSplit,
MultiViewLeaf,
Panel,
PlotCanvas,
PopupWindow,
PyWindow,
RowDragWindow,
SashWindow,
SplashScreenWindow,
SplitterWindow,
StatusBar,
TopLevelWindow,
TreeCompanionWindowwx.Window is the base class for all windows and represents any visible object on the screen. All controls, top level windows and so on are wx.Windows. Sizers and device contexts are not however, as they don't appear on screen themselves.
wx.SIMPLE_BORDER Displays a thin border around the window. wx.DOUBLE_BORDER Displays a double border. Windows and Mac only. wx.SUNKEN_BORDER Displays a sunken border. wx.RAISED_BORDER Displays a raised border. wx.STATIC_BORDER Displays a border suitable for a static control. Windows only. wx.NO_BORDER Displays no border, overriding the default border style for the window. wx.TRANSPARENT_WINDOW The window is transparent, that is, it will not receive paint events. Windows only. wx.TAB_TRAVERSAL Use this to enable tab traversal for non-dialog windows. wx.WANTS_CHARS Use this to indicate that the window wants to get all char/key events for all keys - even for keys like TAB or ENTER which are usually used for dialog navigation and which wouldn't be generated without this style. If you need to use this style in order to get the arrows or etc., but would still like to have normal keyboard navigation take place, you should create and send a wxNavigationKeyEvent in response to the key events for Tab and Shift-Tab. wx.NO_FULL_REPAINT_ON_RESIZE Disables repainting the window completely when its size is changed. You will have to repaint the new window area manually if you use this style. As of version 2.5.1 this style is on by default. Use wx.FULL_REPAINT_ON_RESIZE to deactivate it. wx.VSCROLL Use this style to enable a vertical scrollbar. Notice that this style cannot be used with native controls which don't support scrollbars nor with top-level windows in most ports. wx.HSCROLL Use this style to enable a horizontal scrollbar. The same limitations as for wx.VSCROLL apply to this style. wx.ALWAYS_SHOW_SB If a window has scrollbars, disable them instead of hiding them when they are not needed (i.e. when the size of the window is big enough to not require the scrollbars to navigate it). This style is currently only implemented for wxMSW and wxUniversal and does nothing on the other platforms. wx.CLIP_CHILDREN Use this style to eliminate flicker caused by the background being repainted, then children being painted over them. Windows only. wx.FULL_REPAINT_ON_RESIZE Use this style to force a complete redraw of the window whenever it is resized instead of redrawing just the part of the window affected by resizing. Note that this was the behaviour by default before 2.5.1 release and that if you experience redraw problems with the code which previously used to work you may want to try this.
wx.WS_EX_VALIDATE_RECURSIVELY By default, Validate/TransferDataTo/FromWindow() only work on direct children of the window (compatible behaviour). Set this flag to make them recursively descend into all subwindows. wx.WS_EX_BLOCK_EVENTS wx.CommandEvents and the objects of the derived classes are forwarded to the parent window and so on recursively by default. Using this flag for the given window allows to block this propagation at this window, i.e. prevent the events from being propagated further upwards. Dialogs have this flag on by default. wx.WS_EX_TRANSIENT Don't use this window as an implicit parent for the other windows: this must be used with transient windows as otherwise there is the risk of creating a dialog/frame with this window as a parent which would lead to a crash if the parent is destroyed before the child. wx.WS_EX_PROCESS_IDLE This window should always process idle events, even if the mode set by wx.IdleEvent.SetModeis wx.IDLE_PROCESS_SPECIFIED.wx.WS_EX_PROCESS_UI_UPDATES This window should always process UI update events, even if the mode set by wx.UpdateUIEvent.SetModeis wxUPDATE_UI_PROCESS_SPECIFIED.
| Method Summary | |
|---|---|
| Window |
Construct and show a generic Window. |
| bool |
Can this window have focus? |
| bool |
Can this window be given focus by keyboard navigation? if not, the only way to give it focus (provided it accepts it at all) is to click it. |
Adds a child window. | |
| int |
Mirror coordinates for RTL layout if this window uses it and if the mirroring is not done automatically like Win32. |
Associate the window with a new native handle | |
Cache the best size so it doesn't need to be calculated again, (at least until some properties of the window change.) | |
| bool |
Returns True if the platform supports setting the transparency for this window. |
Directs all mouse input to this window. | |
Centers the window. | |
Center with respect to the the parent window | |
Centers the window. | |
Center with respect to the the parent window | |
Clears the window by filling it with the current background colour. | |
| Point |
Converts to screen coordinates from coordinates relative to this window. |
| (x,y) |
Converts to screen coordinates from coordinates relative to this window. |
| bool |
This function simply generates a EVT_CLOSE event whose handler usually tries to close the window. |
| Point |
Converts a point or size from dialog units to pixels. |
| Size |
Converts a point or size from dialog units to pixels. |
| Point | ConvertPixelPointToDialog(self,
pt)
|
| Size | ConvertPixelSizeToDialog(self,
sz)
|
| bool |
Create the GUI part of the Window for 2-phase creation mode. |
| bool |
Destroys the window safely. |
| bool |
Destroys all children of a window. |
| bool |
Disables the window, same as Enable(false). |
Dissociate the current native handle from the window | |
| Point |
Converts a point or size from dialog units to pixels. |
| Size |
Converts a point or size from dialog units to pixels. |
Enables or disables eligibility for drop file events, EVT_DROP_FILES. | |
| bool |
Enable or disable the window for user input. |
| Window |
Returns the window or control that currently has the keyboard focus, or None. (Static method) |
| Window |
Find a child of this window by window ID |
| Window |
Find a child of this window by name |
Sizes the window so that it fits around its subwindows. | |
Similar to Fit, but sizes the interior (virtual) size of a window. | |
Freezes the window or, in other words, prevents any updates from taking place on screen, the window is not redrawn at all. | |
| AcceleratorTable |
Gets the accelerator table for this window. |
Use GetEffectiveMinSize instead. | |
| bool |
Returns the current autoLayout setting |
| Colour |
Returns the background colour of the window. |
| int |
Returns the background style of the window. |
Use GetEffectiveMinSize instead. | |
| Size |
This function returns the best acceptable minimal size for the window, if applicable. |
| (width, height) |
This function returns the best acceptable minimal size for the window, if applicable. |
| Size |
Return the largest of ClientSize and BestSize (as determined by a sizer, interior children, or other means) |
| int |
GetBorder(self) -> int |
| Window |
Returns the window which currently captures the mouse or None (Static method) |
| Caret |
Returns the caret associated with the window. |
| int |
Get the (average) character size for the current font. |
| int |
Get the (average) character size for the current font. |
| WindowList |
Returns an object containing a list of the window's children. |
| VisualAttributes |
Get the default attributes for this class. (Static method) |
| Point |
Get the origin of the client area of the window relative to the window's top left corner (the client area may be shifted because of the borders, scrollbars, other decorations...) |
| Rect |
Get the client area position and size as a wx.Rect object. |
| Size |
This gets the size of the window's 'client area' in pixels. |
| (width, height) |
This gets the size of the window's 'client area' in pixels. |
| LayoutConstraints |
Returns a pointer to the window's layout constraints, or None if there are none. |
| Sizer |
Return the sizer that this window is a member of, if any, otherwise None. |
| Cursor |
Return the cursor associated with this window. |
| VisualAttributes |
Get the default attributes for an instance of this class. |
| DropTarget |
Returns the associated drop target, which may be None. |
| Size |
This function will merge the window's best size into the window's minimum size, giving priority to the min size components, and returns the results. |
| EvtHandler |
Returns the event handler for this window. |
| long |
Returns the extra style bits for the window. |
| Font |
Returns the default font used for this window. |
| Colour |
Returns the foreground colour of the window. |
| (width, height, descent, externalLeading) |
Get the width, height, decent and leading of the text using the current or specified font. |
| Window |
Returns the parent of the parent of this window, or None if there isn't one. |
| long |
On wxGTK returns a pointer to the GtkWidget for this window as a long integer. |
| long |
Returns the platform-specific handle (as a long integer) of the physical window. |
| String |
Gets the help text to be used as context-sensitive help for this window. |
GetHelpTextAtPoint(self, Point pt, wxHelpEvent::Origin origin) -> String | |
| int |
Returns the identifier of the window. |
| String |
Generic way of getting a label from any window, for identification purposes. |
| int |
Get the layout direction (LTR or RTL) for this window. |
| int | GetMaxHeight(self)
|
| Size | GetMaxSize(self)
|
| int | GetMaxWidth(self)
|
| int | GetMinHeight(self)
|
| Size | GetMinSize(self)
|
| int | GetMinWidth(self)
|
| String |
Returns the windows name. |
| Window |
Returns the parent window of this window, or None if there isn't one. |
| Point |
Get the window's position. |
| (x,y) |
Get the window's position. |
| Rect |
Returns the size and position of the window as a wx.Rect object. |
| Point |
Get the position of the window in screen coordinantes. |
| (x,y) |
Get the position of the window in screen coordinantes. |
| Rect |
Returns the size and position of the window in screen coordinantes as a wx.Rect object. |
| int |
Returns the built-in scrollbar position. |
| int |
Returns the built-in scrollbar range. |
| int |
Returns the built-in scrollbar thumb size. |
| Size |
Get the window size. |
| Sizer |
Return the sizer associated with the window by a previous call to SetSizer or None if there isn't one. |
| (width, height) |
Get the window size. |
| (width, height) |
Get the width and height of the text using the current font. |
| bool |
Return the themeEnabled flag. |
| ToolTip |
get the associated tooltip or None if none |
| Window |
Returns the first frame or dialog in this window's parental hierarchy. |
| Rect |
Get the update rectangle region bounding box in client coords. |
| Region |
Returns the region specifying which parts of the window have been damaged. |
| Validator |
Returns a pointer to the current validator for the window, or None if there is none. |
| Size |
Get the the virtual size of the window in pixels. |
| (width, height) |
Get the the virtual size of the window in pixels. |
| Size |
Return the size of the left/right and top/bottom borders. |
| long |
Gets the window style that was passed to the constructor or Create method. |
| long |
Gets the window style that was passed to the constructor or Create method. |
| int | GetWindowVariant(self)
|
| bool |
Returns true if this window has the current mouse capture. |
| bool |
Test if the given style is set for this window. |
| bool | HasMultiplePages(self)
|
| bool |
Does the window have the scrollbar for this orientation? |
| bool |
Returns True if this window's background is transparent (as, for example, for wx.StaticText) and should show the parent window's
background. |
| bool |
Equivalent to calling Show(False). |
| int |
Test where the given (in client coords) point lies |
| int |
Test where the given (in client coords) point lies |
This function is (or should be, in case of custom controls) called during window creation to intelligently set up the window visual attributes, that is the font and the foreground and background colours. | |
| bool | InheritsBackgroundColour(self)
|
Sends an EVT_INIT_DIALOG event, whose handler usually transfers data to the dialog via validators. | |
Reset the cached best size value so it will be recalculated the next time it is needed. | |
| bool |
Is the window in the process of being deleted? |
| bool |
Returns True if the window contents is double-buffered by the system, i.e. |
| bool |
Returns true if the window is enabled for input, false otherwise. |
| bool |
Returns true if the given point or rectangle area has been exposed since the last repaint. |
| bool |
Returns true if the given point or rectangle area has been exposed since the last repaint. |
| bool |
Returns true if the given point or rectangle area has been exposed since the last repaint. |
| bool |
Returns True if the window has been frozen and not thawed yet. |
| bool |
Returns true if the window is retained, false otherwise. |
| bool |
Returns true if the window is shown, false if it has been hidden. |
| bool |
Returns True if the window is physically visible on the screen, i.e. |
| bool |
Returns true if the given window is a top-level one. |
| bool |
Invokes the constraint-based layout algorithm or the sizer-based algorithm for this window. |
| bool |
This is just a wrapper for ScrollLines(1). |
| bool |
This is just a wrapper for ScrollLines(-1). |
Lowers the window to the bottom of the window hierarchy. | |
Disables all other windows in the application so that the user can only interact with this window. | |
Moves the window to the given position. | |
Moves this window in the tab navigation order after the specified sibling window. | |
Same as MoveAfterInTabOrder except that it inserts this window just
before win instead of putting it right after it. | |
Moves the window to the given position. | |
| bool |
Does keyboard navigation from this window to another, by sending a wx.NavigationKeyEvent. |
| int |
Generate a control id for the controls which were not given one. (Static method) |
| int |
Get the id of the control following the one with the given autogenerated) id (Static method) |
| bool |
This is just a wrapper for ScrollPages(1). |
| bool |
This is just a wrapper for ScrollPages(-1). |
| EvtHandler |
Removes and returns the top-most event handler on the event handler stack. |
| bool |
Pops up the given menu at the specified coordinates, relative to this window, and returns control when the user has dismissed the menu. |
| bool |
Pops up the given menu at the specified coordinates, relative to this window, and returns control when the user has dismissed the menu. |
Phase 3 of the 2-phase create <wink!> Call this method after precreating the window with the 2-phase create method. | |
Call this function to prepare the device context for drawing a scrolled image. | |
| int |
Get the id of the control preceding the one with the given autogenerated) id (Static method) |
Pushes this event handler onto the event handler stack for the window. | |
Raises the window to the top of the window hierarchy. | |
Mark the specified rectangle (or the whole window) as "dirty" so it will be repainted. | |
Redraws the contents of the given rectangle: the area inside it will be repainted. | |
| bool |
Registers a system wide hotkey. |
Releases mouse input captured with wx.Window.CaptureMouse. | |
Removes a child window. | |
| bool |
Find the given handler in the event handler chain and remove (but not delete) it from the event handler chain, returns True if it was found and False otherwise (this also results in an assert failure so this function should only be called when the handler is supposed to be there.) |
| bool |
Reparents the window, i.e the window will be removed from its current parent window (e.g. |
| Point |
Converts from screen to client window coordinates. |
| (x,y) |
Converts from screen to client window coordinates. |
| bool |
If the platform and window class supports it, scrolls the window by the given number of lines down, if lines is positive, or up if lines is negative. |
| bool |
If the platform and window class supports it, scrolls the window by the given number of pages down, if pages is positive, or up if pages is negative. |
Physically scrolls the pixels in the window and move child windows accordingly. | |
SendSizeEvent(self)
| |
Sets the accelerator table for this window. | |
Determines whether the Layout function will be called automatically when the window is resized. | |
| bool |
Sets the background colour of the window. |
| bool |
Returns the background style of the window. |
Use SetInitialSize | |
Sets the caret associated with the window. | |
This sets the size of the window client area in pixels. | |
This sets the size of the window client area in pixels. | |
This sets the size of the window client area in pixels. | |
Sets the window to have the given layout constraints. | |
This normally does not need to be called by application code. | |
| bool |
Sets the window's cursor. |
Sets the position and size of the window in pixels. | |
Currently wxGTK2 only. | |
Associates a drop target with this window. | |
Sets the event handler for this window. | |
Sets the extra style bits for the window. | |
Set's the focus to this window, allowing it to receive keyboard input. | |
Set focus to this window as the result of a keyboard action. | |
| bool |
Sets the font for this window. |
| bool |
Sets the foreground colour of the window. |
Sets the help text to be used as context-sensitive help for this window. | |
Associate this help text with all windows with the same id as this one. | |
Sets the identifier of the window. | |
A 'Smart' SetSize that will fill in default size components with the window's best size values. | |
Set the text which the window shows in its label if applicable. | |
Set the layout direction (LTR or RTL) for this window. | |
A more convenient method than SetSizeHints for setting just the
max size. | |
A more convenient method than SetSizeHints for setting just the
min size. | |
Sets the window's name. | |
SetOwnBackgroundColour(self,
colour)
| |
SetOwnFont(self,
font)
| |
SetOwnForegroundColour(self,
colour)
| |
Moves the window to the given position. | |
Sets the position and size of the window in pixels using a wx.Rect. | |
| |
Sets the position of one of the built-in scrollbars. | |
Sets the size of the window in pixels. | |
Allows specification of minimum and maximum window sizes, and window size increments. | |
Allows specification of minimum and maximum window sizes, and window size increments. | |
Sets the window to have the given layout sizer. | |
The same as SetSizer, except it also sets the size hints for the window based on the sizer's minimum size. | |
Sets the size of the window in pixels. | |
code to draw the windows' background instead if its own background drawing code. | |
Attach a tooltip to the window. | |
Attach a tooltip to the window. | |
| bool |
Attempt to set the transparency of this window to the alpha value, returns True on success. |
Deletes the current validator (if any) and sets the window validator, having called wx.Validator.Clone to create a new validator of this type. | |
Set the the virtual size of a window in pixels. | |
Allows specification of minimum and maximum virtual window sizes. | |
Allows specification of minimum and maximum virtual window sizes. | |
Set the the virtual size of a window in pixels. | |
Sets the style of the window. | |
Sets the style of the window. | |
Sets the variant of the window/font size to use for this window, if the platform supports variants, for example, wxMac. | |
| bool |
Return true from here to allow the colours of this window to be changed by InheritAttributes, returning false forbids inheriting them from the parent window. |
| bool |
Shows or hides the window. |
Reenables window updating after a previous call to Freeze. | |
| bool |
Turn the flag on if it had been turned off before and vice versa, returns True if the flag is turned on by this function call. |
| bool |
Transfers values from child controls to data areas specified by their validators. |
| bool |
Transfers values to child controls from data areas specified by their validators. |
| bool |
Unregisters a system wide hotkey. |
Calling this method immediately repaints the invalidated area of the window instead of waiting for the EVT_PAINT event to happen, (normally this would usually only happen when the flow of control returns to the event loop.) Notice that this function doesn't refresh the window and does nothing if the window has been already repainted. | |
This function sends EVT_UPDATE_UI events to the window. | |
| bool | UseBgCol(self)
|
| bool |
Validates the current values of the child controls using their validators. |
Moves the pointer to the given position on the window. | |
| Instance Method Details |
|---|
__init__(self,
parent,
id=-1,
pos=DefaultPosition,
size=DefaultSize,
style=0,
name=PanelNameStr)
|
AcceptsFocus(self)Can this window have focus?
|
AcceptsFocusFromKeyboard(self)Can this window be given focus by keyboard navigation? if not, the only way to give it focus (provided it accepts it at all) is to click it.
|
AddChild(self, child)Adds a child window. This is called automatically by window creation functions so should not be required by the application programmer.
|
AdjustForLayoutDirection(self, x, width, widthTotal)Mirror coordinates for RTL layout if this window uses it and if the mirroring is not done automatically like Win32.
|
AssociateHandle(self, handle)Associate the window with a new native handle
|
CacheBestSize(self, size)Cache the best size so it doesn't need to be calculated again, (at least until some properties of the window change.)
|
CanSetTransparent(self)Returns True if the platform supports setting the transparency for this window. Note that this method will err on the side of caution, so it is possible that this will return False when it is in fact possible to set the transparency. NOTE: On X-windows systems the X server must have the composite extension loaded, and there must be a composite manager program (such as xcompmgr) running.
|
CaptureMouse(self)Directs all mouse input to this window. Call wx.Window.ReleaseMouse to release the capture. Note that wxWindows maintains the stack of windows having captured the
mouse and when the mouse is released the capture returns to the window
which had had captured it previously and it is only really released if
there were no previous window. In particular, this means that you must
release the mouse as many times as you capture it, unless the window
receives the Any application which captures the mouse in the beginning of some
operation must handle |
Center(self, direction=BOTH)Centers the window. The parameter specifies the direction for cetering, and may be wx.HORIZONTAL, wx.VERTICAL or wx.BOTH. It may also include wx.CENTER_ON_SCREEN flag if you want to center the window on the entire screen and not on its parent window. If it is a top-level window and has |