A window class.
Parameters: |
|
---|
Creates a new window. The window is initially hidden so you have to show it later: window.show(SW_SHOW).
Clips (or frees) the cursor to the client area of the window. Use with care.
Closes the window. Do not attempt to use the window after this. This is also called when the Window is garbage collected.
Returns the internal window handle (HWND) as an integer.
Returns all new messages and empties the message queue. A message is a 11-component named tuple. They are normal Windows messages and most MSDN-information applies to them. Some related constants are not in d3d11c (yet).
Message attributes:
- code - Message code, for example WM_MOUSEMOVE.
- wparam - Meaning depends from the code. See MSDN documentation. For example if code is WM_KEYDOWN this would be a virtual key code.
- lparam - Meaning depends from the code. See MSDN documentation.
- x - Mouse x-coordinate in client coordinates (ie. can be negative or outside the window).
- y - Mouse y-coordiante in client coordinates.
- wheel - Mouse wheel delta. 0 if not a mouse wheel message.
- vk - Virtual key code, for example VK_SPACE. This has the same value as wparam but is easier to remember.
- char - Unicode character if a WM_CHAR-message, otherwise None.
- shift - True if any shift key was down when the message was received.
- ctrl - True if any ctrl key was down when the message was received.
- alt - True if any alt key was down when the message was received.
Takes the monitor which is nearest to this window and returns it’s virtual screen area. In multi-monitor systems x and y can be negative.
Returns the window area.
With this function it is possible to set a message “hook” function which receives messages before they are handled (when getMessages() is called). This is useful when message parameters contain pointers to some data which is only valid during the message handling. If the callback returns True message will be ignored and certain internal processing is not done. So don’t return True if you don’t know what you are doing! The returned value will be the old callback (if any) so that you can “chain” callbacks.
oldCallback = None
def messageCallback(msg):
if msg.code == WM_KEYUP and msg.vk == VK_F1:
showHelpOrSomething()
elif oldCallback:
return oldCallback(msg) #Call the old callback.
oldCallback = w.setCallback(messageCallback)
Parameters: |
|
---|
Sets the cursor.
Parameters: |
|
---|
Sets the window’s class icon. All windows created by DirectPython will share this icon.
Parameters: |
|
---|
Updates window area.
Updates window title.
Parameters: |
|
---|
Changes (hides, shows, maximises etc.) window state.
Shows or hides the cursor. This applies only when the mouse cursor is inside the client area.