77
88class Application ():
99 def __init__ (self , network : GUINetwork , width = 1400 , height = 900 , title = "BindsNET GUI" ,
10+ header : str | None = None ,
1011 step_rate : int | str = 500 , draw_fps : float | None = None ):
1112 self .width , self .height = width , height
1213 self .network = network
@@ -32,7 +33,21 @@ def __init__(self, network: GUINetwork, width=1400, height=900, title="BindsNET
3233 size = (self .width , self .height ),
3334 show = True ,
3435 )
35- self .grid = self .canvas .central_widget .add_grid (margin = 10 )
36+ # Top-level layout: an optional centered title spanning the full width, above
37+ # the grid of plotting widgets. When there's no title we still reserve a small
38+ # spacer row so the topmost axis tick labels aren't clipped by the canvas edge.
39+ self .layout = self .canvas .central_widget .add_grid (margin = 0 )
40+ next_row = 0
41+ if header is not None :
42+ self .title_label = scene .Label (header , color = 'white' , font_size = 20 , bold = True )
43+ self .title_label .height_max = 48
44+ self .layout .add_widget (self .title_label , row = next_row , col = 0 )
45+ else :
46+ self .title_label = None
47+ self .layout .add_widget (row = next_row , col = 0 ).height_max = 12 # top padding
48+ next_row += 1
49+
50+ self .grid = self .layout .add_grid (row = next_row , col = 0 , margin = 10 )
3651
3752 # Migrate network tensors to shared OpenGL buffers
3853 network .migrate ()
0 commit comments