NiceGui_prog

from nicegui import ui
import pandas as pd
import matplotlib, numpy
ui.label('Welcome to NiceGUI!')
ui.button('Click Here', on_click=lambda: ui.notify('Button Pressed'))
ui.icon('fingerprint', color='primary').classes('text-5xl')

ui.link('百度', 'https://www.baidu.com')
toggle = ui.toggle([1, 2, 3], value=1)
ui.label('Radio Selection')

radio = ui.radio(["one", "two", "three"], value=1).props('inline')
ui.label('Dropdown Select')

select = ui.select(["red", "blue", "green"], value=1)
ui.label('Check Box')

checkbox = ui.checkbox('check me')
ui.input(label='Text',
on_change=lambda e: text_input.set_text('Your Input: ' + e.value))
text_input = ui.label()
ui.number(label='Number', value=3.1415, format='%.2f',
on_change=lambda e: number_input.set_text('Your Input: ' + str(e.value)))
with ui.row():
radio1 = ui.radio([1, 2, 3], value=1).props('inline')
toggle = ui.toggle({1: 'A', 2: 'B', 3: 'C'}).props('inline').bind_value(radio1, 'value')
number_input = ui.label()
columns = [
{'name': 'Name', 'label': 'Name', 'field': 'Name', 'required': True, 'align': 'center'},
{'name': 'Employee-ID', 'label': 'Employee-ID', 'field': 'Employee-ID'},
{'name': 'experience', 'label': 'experience', 'field': 'experience'}
]

rows = [
{'Name': 'Akash', 'Employee-ID': 1230, 'experience': 5},
{'Name': 'Karen', 'Employee-ID': 1245, 'experience': 10},
{'Name': 'Thanish', 'Employee-ID': 1980, 'experience': 9},
{'Name': 'Samuel', 'Employee-ID': 1120, 'experience': 8},
]

ui.table(columns=columns, rows=rows, row_key='Name')
data = pd.DataFrame(data={'Name': ["Karan", "Shoaib"], 'Role': ["Developer", "Designer"]})
ui.table(
columns=[{'name': column, 'label': column, 'field': column} for column in data.columns],
rows=data.to_dict('records'),
)

data = pd.DataFrame(data={'Name': ["Karan", "Shoaib"], 'Role': ["Developer", "Designer"]})
ui.table(
columns=[{'name': column, 'label': column, 'field': column} for column in data.columns],
rows=data.to_dict('records'),

)

with ui.pyplot(figsize=(3, 2)):
x = numpy.linspace(0.0, 10000.0, 10)
y = numpy.log(x)
matplotlib.pyplot.title('Log Graph')
matplotlib.pyplot.plot(x, y, '-')
ui.run()
posted @   祺琪  阅读(125)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架
点击右上角即可分享
微信分享提示