window method in pyleap
The four handy window methods are explained with an example:
1. window.set_size()
A default window size is width = 640 and height=480. But you can change as per your requirement. To change your window size use the command:
window.set_size(400, 500) # width (400), height(500)
# (or)
window.width = 500
window.height = 400
2. window.set_caption()
By default, the window caption will be leap learner but you can change using the set_caption method. It will take a string as a parameter.
window.set_caption("My First game")
3. window.clear()
The position of the window.clear() matters.
- If it was placed after any object creation, it will clear everything done before it.
- If it is placed before any object creation, it will clear the window first and then starts object creation.
from pyleap import *
def Draw(dt):
window.clear()
repeat(Draw)
run()
4. window.show_axis()
This method will display coordinates of the canvas which will be very helpful while drawing shapes.
from pyleap import *
def Draw(dt):
window.show_axis()
repeat(Draw)
run()