Skip to content

Commit feb5c08

Browse files
author
Tom De Smedt
committed
border=True parameter for Canvas()
1 parent 52921fa commit feb5c08

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

nodebox/graphics/context.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3400,6 +3400,10 @@ def __repr__(self):
34003400

34013401
FRAME = 0
34023402

3403+
# Window styles.
3404+
WINDOW_DEFAULT = pyglet.window.Window.WINDOW_STYLE_DEFAULT
3405+
WINDOW_BORDERLESS = pyglet.window.Window.WINDOW_STYLE_BORDERLESS
3406+
34033407
# Configuration settings for the canvas.
34043408
# http://www.pyglet.org/doc/programming_guide/opengl_configuration_options.html
34053409
# The stencil buffer is enabled (we need it to do clipping masks).
@@ -3434,7 +3438,7 @@ def _configure(settings):
34343438

34353439
class Canvas(list, Prototype, EventHandler):
34363440

3437-
def __init__(self, width=640, height=480, name="NodeBox for OpenGL", resizable=False, settings=OPTIMAL, vsync=True):
3441+
def __init__(self, width=640, height=480, name="NodeBox for OpenGL", resizable=False, border=True, settings=OPTIMAL, vsync=True):
34383442
""" The main application window containing the drawing canvas.
34393443
It is opened when Canvas.run() is called.
34403444
It is a collection of drawable Layer objects, and it has its own draw() method.
@@ -3448,6 +3452,7 @@ def __init__(self, width=640, height=480, name="NodeBox for OpenGL", resizable=F
34483452
width = width,
34493453
height = height,
34503454
resizable = resizable,
3455+
style = border is False and WINDOW_BORDERLESS or WINDOW_DEFAULT,
34513456
config = _configure(settings),
34523457
vsync = vsync
34533458
)
@@ -4010,7 +4015,7 @@ def run(self, draw=None, setup=None, update=None, frames=100, sort=CUMULATIVE, t
40104015

40114016
#--- LIBRARIES ---------------------------------------------------------------------------------------
40124017
# Import the library and assign it a _ctx variable containing the current context.
4013-
# This mimics the behavior in NodeBox.
4018+
# This mimics the behavior in NodeBox for Mac OS X.
40144019

40154020
def ximport(library):
40164021
from sys import modules

nodebox/graphics/shader.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
# Copyright (c) 2008 City In A Bottle (cityinabottle.org)
66
# http://cityinabottle.org/nodebox
77

8-
from pyglet.image import Texture, SolidColorImagePattern
98
from pyglet.gl import *
9+
from pyglet.image import Texture, SolidColorImagePattern
10+
from context import Image, texture
1011
from geometry import lerp, clamp
1112
from math import radians
1213

@@ -1123,8 +1124,6 @@ def __del__(self):
11231124
except OffscreenBufferError:
11241125
_buffer = None
11251126

1126-
from context import Image, texture
1127-
11281127
def filter(img, filter=None, clear=True):
11291128
""" Returns a new Image object with the given filter applied to it.
11301129
- img : an image that can be passed to the image() command.

0 commit comments

Comments
 (0)