EasySci commited on
Commit
d6b80b8
·
1 Parent(s): a6370c4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -11
app.py CHANGED
@@ -8,29 +8,34 @@ toggle_sidebar = pn.widgets.Button(name='☰', button_type='primary', width=30,
8
  toggle_sidebar.js_on_click(args={'sidebar': toggle_sidebar}, code="""
9
  if (sidebar.width == 0) {
10
  sidebar.width = 200;
 
11
  } else {
12
  sidebar.width = 0;
 
13
  }
14
  """)
15
 
16
- # Create buttons for the toggle sidebar
17
  button1 = pn.widgets.Button(name='Button 1')
18
  button2 = pn.widgets.Button(name='Button 2')
19
  button3 = pn.widgets.Button(name='Button 3')
20
 
21
- # Create a column layout for the buttons inside the toggle sidebar
22
- sidebar = pn.Column(button1, button2, button3, sizing_mode='stretch_height', background='#f6f6f6')
 
23
  # Combine the title, toggle button, and sidebar
24
- app = pn.Row(
25
- toggle_sidebar,
26
- pn.Column(
27
- title,
28
- pn.layout.Spacer(height=10),
29
- sidebar,
30
  sizing_mode='stretch_both',
31
  ),
32
- sizing_mode='stretch_both'
33
  )
34
 
35
  # Run the app
36
- app.servable()
 
 
 
8
  toggle_sidebar.js_on_click(args={'sidebar': toggle_sidebar}, code="""
9
  if (sidebar.width == 0) {
10
  sidebar.width = 200;
11
+ buttons.visible = True;
12
  } else {
13
  sidebar.width = 0;
14
+ buttons.visible = False;
15
  }
16
  """)
17
 
18
+ # Create buttons for the toggleable sidebar
19
  button1 = pn.widgets.Button(name='Button 1')
20
  button2 = pn.widgets.Button(name='Button 2')
21
  button3 = pn.widgets.Button(name='Button 3')
22
 
23
+ # Create a column layout for the buttons inside the toggleable sidebar
24
+ buttons = pn.Column(button1, button2, button3, visible=False, sizing_mode='stretch_height', background='#f6f6f6')
25
+
26
  # Combine the title, toggle button, and sidebar
27
+ app = pn.Column(
28
+ pn.Row(toggle_sidebar),
29
+ pn.Row(
30
+ pn.Column(title, pn.layout.Spacer(height=10)),
31
+ pn.layout.Divider(),
32
+ pn.Row(buttons, sizing_mode='stretch_width'),
33
  sizing_mode='stretch_both',
34
  ),
35
+ sizing_mode='stretch_both',
36
  )
37
 
38
  # Run the app
39
+ app.servable()
40
+
41
+ Send a message in "App"