Class OGLWindow
About :
Window management
Functions
Function | summury |
---|---|
__init__(self, name=’Oglwindow’, size=(700, 700), pos=(400, 400), at_init=None, stereo=False, app=None, with_borders=True, shared_canvas=None) | |
on_close_callback(self, window) | callback when window is closed (more…) |
on_refresh_callback(self, window) | |
on_maximize_callback(self, window, maximized) | |
on_resize_callback(self, window, w, h) | callback when window is resized (more…) |
set_cursor_cross_hair(self, crosshair=True) | change window cursor to crosshair (more…) |
set_cursor_position(self, px, py) | set the cursor position (more…) |
set_cursor_mode(self, mode=1) | change the cursor behavior (more…) |
hide(self) | iconify window (more…) |
show(self) | restore window from iconification (more…) |
set_position(self, position=(0, 0)) | set window position (more…) |
set_size(self, size=(600, 300)) | set window size (more…) |
get_size(self, size=(600, 300)) | set window size (more…) |
get_frame_buffer_size(self, size=(600, 300)) | set window size (more…) |
set_fullscreen(self, enable=True) | set window fullscreen (more…) |
switch_fullscreen(self) | switch the window between full screen and normal size (more…) |
add_canvas(self, canvas) | add a canvas to a window (more…) |
remove_canvas(self, canvas) | remove a canvas from a window (more…) |
add_resize_callback(self, function) | add a function to a to resize callback stack (more…) |
remove_resize_callback(self, function) | remove a function to a to resize callback stack (more…) |
set_title(self, title) | set the title of the window banner (more…) |
set_icon(self, filename) | set the icon image for the operating system (more…) |
swap_buffers(self) | swap buffers for the window (more…) |
set_background_color(self, r, g, b, a) | set the window background color (more…) |
on_key(self, window, key, scancode, action, mods) | when a key is pressed (more…) |
on_keyboard(self, window, codepoint, mods) | internal callback called whenever the keyboard is activated (more…) |
on_mouse_button(self, window, button, action, mods) | Transfer event towards canvas (more…) |
on_mouse_motion(self, window, x, y) | Transfer event towards canvas (more…) |
on_mouse_wheel(self, window, xoffset, yoffset) | Transfer event towards canvas (more…) |
Methods desciption :
init
def __init__(self, name='Oglwindow', size=(700, 700), pos=(400, 400), at_init=None, stereo=False, app=None, with_borders=True, shared_canvas=None)
on_close_callback
def on_close_callback(self, window)
callback when window is closed
- → window the closed window
on_refresh_callback
def on_refresh_callback(self, window)
on_maximize_callback
def on_maximize_callback(self, window, maximized)
on_resize_callback
def on_resize_callback(self, window, w, h)
callback when window is resized
- → window : resized object
- → w : new width
- → h : new hight
set_cursor_cross_hair
def set_cursor_cross_hair(self, crosshair=True)
change window cursor to crosshair
- → crosshair : boolean : if True set to crosshair overwise return to traditional arrow
set_cursor_position
def set_cursor_position(self, px, py)
set the cursor position
- → px E [-1,1] on horizontal axis from left to right
- → py E [-1,1] on vertical axis from bottom to top
set_cursor_mode
def set_cursor_mode(self, mode=1)
change the cursor behavior
- → mode 1 : GLFW_CURSOR_NORMAL makes the cursor visible and behaving normally. (The default) 0 : GLFW_CURSOR_HIDDEN makes the cursor invisible when it is over the client area of the window but does not restrict the cursor from leaving. -1 :GLFW_CURSOR_DISABLED hides and grabs the cursor, providing virtual and unlimited cursor movement. This is useful for implementing for example 3D camera controls.
hide
def hide(self)
iconify window
show
def show(self)
restore window from iconification
set_position
def set_position(self, position=(0, 0))
set window position
- → position : 2 entry tuple =(x,y) x from left to right y from top to bottom
set_size
def set_size(self, size=(600, 300))
set window size
- → size : 2 entry tuple =(width,height)
get_size
def get_size(self, size=(600, 300))
set window size
- ← : 2 entry tuple =(width,height)
get_frame_buffer_size
def get_frame_buffer_size(self, size=(600, 300))
set window size
- ← : 2 entry tuple =(width,height)
set_fullscreen
def set_fullscreen(self, enable=True)
set window fullscreen
- → enable : boolean : if True window is set full screen, overwise it came back to the previous position and size
switch_fullscreen
def switch_fullscreen(self)
switch the window between full screen and normal size
add_canvas
def add_canvas(self, canvas)
add a canvas to a window
remove_canvas
def remove_canvas(self, canvas)
remove a canvas from a window
add_resize_callback
def add_resize_callback(self, function)
add a function to a to resize callback stack
remove_resize_callback
def remove_resize_callback(self, function)
remove a function to a to resize callback stack
set_title
def set_title(self, title)
set the title of the window banner
- → title
set_icon
def set_icon(self, filename)
set the icon image for the operating system
- → filename : an icon image filename
swap_buffers
def swap_buffers(self)
swap buffers for the window Initiallly this function was associated to the canvas But this must be only once per frame for the overall window when several canvas are combined on a same window
set_background_color
def set_background_color(self, r, g, b, a)
set the window background color
- → r : red component ([0,1])
- → g : green component ([0,1])
- → b : blue component ([0,1])
- → a : transparency component ([0,1]) if the Window System allows it
on_key
def on_key(self, window, key, scancode, action, mods)
when a key is pressed
- → window
- → key
- → scancode : ? see glfw
- → action : key is released or pressed
- → mods : moditiers : shift,alt,ctrl
on_keyboard
def on_keyboard(self, window, codepoint, mods)
internal callback called whenever the keyboard is activated
Indeed the keyboard event is redirected a single callback associated with th OGLApp
on_mouse_button
def on_mouse_button(self, window, button, action, mods)
Transfer event towards canvas
- → button == 0 : left, 1 : middle, 3 : right
- → mode == pass True for Down
- → x,y == x,y position in the window
on_mouse_motion
def on_mouse_motion(self, window, x, y)
Transfer event towards canvas
- → x,y == x,y position in the window
on_mouse_wheel
def on_mouse_wheel(self, window, xoffset, yoffset)
Transfer event towards canvas
- → x,y == x,y position in the window