add configuration parameters for colors
This commit is contained in:
parent
f6cc39914b
commit
72c1865cf6
@ -23,6 +23,9 @@ class SketchWidget:
|
|||||||
self.axis_width = 1.8
|
self.axis_width = 1.8
|
||||||
self.axis_length = 50
|
self.axis_length = 50
|
||||||
self.zoom_factor = 1.2
|
self.zoom_factor = 1.2
|
||||||
|
self.background_color = (0.6, 0.9, 1.0, 1.0)
|
||||||
|
self.line_color = (0.1, 0.4, 1.0, 1.0)
|
||||||
|
self.axis_color = (1.0, 0.0, 0.0, 1.0)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# try double-buffered
|
# try double-buffered
|
||||||
@ -62,6 +65,8 @@ class SketchWidget:
|
|||||||
# glEnable(GL_POLYGON_SMOOTH)
|
# glEnable(GL_POLYGON_SMOOTH)
|
||||||
# glEnable(GL_LINE_SMOOTH)
|
# glEnable(GL_LINE_SMOOTH)
|
||||||
|
|
||||||
|
glClearColor(*self.background_color)
|
||||||
|
|
||||||
gldrawable.gl_end()
|
gldrawable.gl_end()
|
||||||
|
|
||||||
def reshape(self, glarea, event):
|
def reshape(self, glarea, event):
|
||||||
@ -99,6 +104,7 @@ class SketchWidget:
|
|||||||
|
|
||||||
self.drawAxes()
|
self.drawAxes()
|
||||||
|
|
||||||
|
glColor(*self.line_color)
|
||||||
for shape in self.sketch:
|
for shape in self.sketch:
|
||||||
if isinstance(shape, Line):
|
if isinstance(shape, Line):
|
||||||
self.drawLine(shape, self.line_width)
|
self.drawLine(shape, self.line_width)
|
||||||
@ -195,7 +201,7 @@ class SketchWidget:
|
|||||||
|
|
||||||
def drawAxes(self):
|
def drawAxes(self):
|
||||||
glPushAttrib(GL_CURRENT_BIT)
|
glPushAttrib(GL_CURRENT_BIT)
|
||||||
glColor(1.0, 0.4, 0.4, 1.0)
|
glColor(*self.axis_color)
|
||||||
cx, cy = self.ptToScreenPt((0, 0))
|
cx, cy = self.ptToScreenPt((0, 0))
|
||||||
self.drawFilledLine(cx - self.axis_length, cy,
|
self.drawFilledLine(cx - self.axis_length, cy,
|
||||||
cx + self.axis_length, cy, self.axis_width)
|
cx + self.axis_length, cy, self.axis_width)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user