123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- from nicegui import ui
- from ..model import DetailDocumentation
- class RunDocumentation(DetailDocumentation, title='ui.*run*', name='run'):
- def content(self) -> None:
- @self.demo(ui.run) # TODO: tab = 'My App'
- def demo() -> None:
- ui.label('page with custom title')
- # ui.run(title='My App')
- @self.demo('Emoji favicon', '''
- You can use an emoji as favicon.
- This works in Chrome, Firefox and Safari.
- ''') # TODO: tab=lambda: ui.markdown('🚀 NiceGUI')
- def emoji_favicon():
- ui.label('NiceGUI Rocks!')
- # ui.run(favicon='🚀')
- @self.demo(
- 'Base64 favicon', '''
- You can also use an base64-encoded image as favicon.
- ''')
- # TODO
- # tab=lambda: (
- # ui.image('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==')
- # .classes('w-4 h-4'),
- # ui.label('NiceGUI'),
- # )
- def base64_favicon():
- ui.label('NiceGUI with a red dot!')
- icon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=='
- # ui.run(favicon=icon)
- @self.demo('SVG favicon', '''
- And directly use an SVG as favicon.
- Works in Chrome, Firefox and Safari.
- ''')
- # TODO
- # tab=lambda: (
- # ui.html('''
- # <svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
- # <circle cx="100" cy="100" r="78" fill="#ffde34" stroke="black" stroke-width="3" />
- # <circle cx="80" cy="85" r="8" />
- # <circle cx="120" cy="85" r="8" />
- # <path d="m60,120 C75,150 125,150 140,120" style="fill:none; stroke:black; stroke-width:8; stroke-linecap:round" />
- # </svg>
- # ''').classes('w-4 h-4'),
- # ui.label('NiceGUI'),
- # )
- def svg_favicon():
- ui.label('NiceGUI makes you smile!')
- smiley = '''
- <svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
- <circle cx="100" cy="100" r="78" fill="#ffde34" stroke="black" stroke-width="3" />
- <circle cx="80" cy="85" r="8" />
- <circle cx="120" cy="85" r="8" />
- <path d="m60,120 C75,150 125,150 140,120" style="fill:none; stroke:black; stroke-width:8; stroke-linecap:round" />
- </svg>
- '''
- # ui.run(favicon=smiley)
|