@@ -22,7 +22,7 @@ def __init__(self, master):
2222
2323 self .app = master
2424 self .root = master .root
25-
25+
2626 self .y_scroll = Scrollbar (self .root )
2727 self .y_scroll .grid (row = 2 , column = 2 , sticky = 'nsew' , rowspan = 3 )
2828 self .scrollable = False
@@ -33,8 +33,20 @@ def __init__(self, master):
3333
3434 # Create a bar for changing console size and displaying info about beat number
3535
36- self .drag = Frame (self .root , bg = "white" , height = 2 , cursor = "sb_v_double_arrow" )
37- self .counter = Counter (self , self .root , bd = 0 , bg = colour_map ['background' ], height = 25 ,)
36+ self .drag = Frame (
37+ self .root ,
38+ bg = "white" ,
39+ height = 2 ,
40+ cursor = "sb_v_double_arrow"
41+ )
42+ self .counter = Counter (
43+ self ,
44+ self .root ,
45+ bd = 0 ,
46+ bg = 'black' ,
47+ height = 25 ,
48+ highlightthickness = 0
49+ )
3850
3951 # Create canvas
4052
@@ -58,7 +70,7 @@ def __init__(self, master):
5870
5971 self .padx = 5
6072 self .pady = 5
61-
73+
6274 self .text_y = 0
6375
6476 self .text_height = 0
@@ -81,14 +93,14 @@ def __init__(self, master):
8193
8294 # Allow for resizing
8395 self .mouse_down = False
84- self .drag .bind ("<Button-1>" , self .drag_mouseclick )
96+ self .drag .bind ("<Button-1>" , self .drag_mouseclick )
8597 self .drag .bind ("<ButtonRelease-1>" , self .drag_mouserelease )
8698 self .drag .bind ("<B1-Motion>" , self .drag_mousedrag )
8799
88100 self .drag .grid (row = 1 , column = 0 , stick = "nsew" , columnspan = 3 )
89101 self .canvas .grid (row = 2 , column = 0 , sticky = "nsew" , columnspan = 2 )
90102 self .counter .grid (row = 3 , column = 0 , sticky = "nsew" , columnspan = 2 )
91-
103+
92104 self .queue = Queue .Queue ()
93105 self .update ()
94106
@@ -118,7 +130,7 @@ def drag_mouseclick(self, event):
118130 self .mouse_down = True
119131 self .root .grid_propagate (False )
120132 return
121-
133+
122134 def drag_mouserelease (self , event ):
123135 self .mouse_down = False
124136 self .app .text .focus_set ()
@@ -132,7 +144,7 @@ def drag_mousedrag(self, event):
132144 if textbox_line_h is not None :
133145
134146 self .app .text .height = int (self .app .text .winfo_height () / textbox_line_h [3 ])
135-
147+
136148 self .root_h = self .height + self .app .text .height
137149
138150 widget_y = self .canvas .winfo_rooty ()
@@ -159,7 +171,7 @@ def update(self):
159171 self .canvas .insert ( self .text , "end" , string )
160172
161173 # Get the text bounding box
162-
174+
163175 bbox = self .canvas .bbox (self .text )
164176
165177 # Text box height
@@ -221,18 +233,18 @@ def canvas_mouseclick(self, event):
221233 # Calculate current mouse pos
222234 x = self .canvas .canvasx (event .x )
223235 y = self .canvas .canvasx (event .y )
224-
236+
225237 self .text_cursor = "@%d,%d" % (x , y )
226-
238+
227239 return
228240
229241 def canvas_mousedrag (self , event ):
230242 """ Changes selection """
231243 x = self .canvas .canvasx (event .x )
232244 y = self .canvas .canvasx (event .y )
233-
245+
234246 xy = "@%d,%d" % (x , y )
235-
247+
236248 self .canvas .select_from (self .text , self .text_cursor )
237249 self .canvas .select_to (self .text , xy )
238250 return
@@ -269,11 +281,11 @@ def scroll_text(self, *args):
269281
270282 def move_text (self , delta ):
271283 """ Moves the text up (negative) or down (positive) """
272-
284+
273285 if SYSTEM != MAC_OS :
274286
275287 delta /= 100
276-
288+
277289 x , y = self .canvas .coords (self .text )
278290
279291 self .text_y = max (min (self .pady , y + delta ), self .max_offset )
@@ -283,9 +295,9 @@ def move_text(self, delta):
283295 self .update_scrollbar ()
284296
285297 return
286-
298+
287299 def on_scroll (self , event ):
288- if self .scrollable : self .move_text (event .delta )
300+ if self .scrollable : self .move_text (event .delta )
289301 return "break"
290302
291303 def get_scrollbar_size (self ):
@@ -301,7 +313,7 @@ def update_scrollbar(self, point=None):
301313 a = point
302314 else :
303315 a = (float (self .text_y ) / self .max_offset ) * (1 - size )
304- b = a + size
316+ b = a + size
305317 self .y_scroll .set (a , b )
306318 return a , b
307319
@@ -347,7 +359,7 @@ def draw_logo(self):
347359
348360 # Shuffle the widths and use a mirrored version for red
349361 random .shuffle (grn_widths )
350-
362+
351363 red_widths = reversed (grn_widths )
352364
353365 start_x = random .choice ([50 ,100 ,150 ,200 ])
@@ -379,7 +391,8 @@ def __init__(self, parent, *args, **kwargs):
379391 Canvas .__init__ (self , * args , ** kwargs )
380392 self .parent = parent
381393 self .metro = self .parent .app .namespace ['Clock' ]
382- self .font = self .parent .app .codefont
394+ self .font = self .parent .app .console_font
395+ self .bg = colour_map .get ('background' , "gray30" )
383396 # Use 4 beats for now - will update in future?
384397
385398 def redraw (self ):
@@ -413,5 +426,6 @@ def redraw(self):
413426 for n in range (cycle ):
414427 x1 , x2 = [(val * box_width ) + (w - width - 35 ) for val in [n , (n + 1 )]]
415428 y1 , y2 = h_offset / 2 , box_height + (h_offset / 2 )
416- bg = "red" if n == beat else "gray30"
417- self .create_rectangle (x1 , y1 , x2 , y2 , fill = bg , outline = "gray30" )
429+ bg = "red" if n == beat else self .bg
430+ # self.create_rectangle(x1, y1, x2, y2, fill=bg, outline="gray30", )
431+ self .create_rectangle (x1 , y1 , x2 , y2 , fill = bg , outline = self .bg , )
0 commit comments