Python 将图像用作IPyFutify中的图标
我正在使用ipyvuetify来编写一个应用程序,以便使用voila进行渲染,我希望使用图像作为页脚的图标,或者在将来作为按钮。知道怎么做吗 这是图标的代码Python 将图像用作IPyFutify中的图标,python,vuetify.js,ipywidgets,voila,Python,Vuetify.js,Ipywidgets,Voila,我正在使用ipyvuetify来编写一个应用程序,以便使用voila进行渲染,我希望使用图像作为页脚的图标,或者在将来作为按钮。知道怎么做吗 这是图标的代码 v.Footer( absolute = False, class_="font-weight-medium", children= [v.Col(class_="text-center", cols="12", children=[v.Ic
v.Footer( absolute = False,
class_="font-weight-medium",
children= [v.Col(class_="text-center", cols="12", children=[v.Icon(children=['fingerprint']),'BMW - 2020 - alpha version 0.0. powered by Soft company PPP'])]
这将产生:
我想使用我自己的标志,而不是预定义的指纹。
那么,我如何加载图像并给出字体的相对大小呢
谢谢目前似乎没有什么好方法可以简单地将相对链接传递到IPYfuetify,并让它显示图像(如果有) 我发现的一种解决方法是使用ipywidgets打开文件,并将其作为对象传递给ipyvuetify:
import ipywidgets as widgets
file = open( 'LINK_TO_YOUR_ICON', 'rb')
image = file.read()
img = widgets.Image(value=image, format='png')
v.Footer( absolute = False,
class_="font-weight-medium",
children= [v.Col(class_="text-center", cols="12", children=[img,'BMW - 2020 - alpha version 0.0. powered by Soft company PPP'])]
)
检查这是否解决了您的问题 目前似乎没有什么好方法可以简单地将相对链接传递给ipyvuetify并让它显示图像(如果有) 我发现的一种解决方法是使用ipywidgets打开文件,并将其作为对象传递给ipyvuetify:
import ipywidgets as widgets
file = open( 'LINK_TO_YOUR_ICON', 'rb')
image = file.read()
img = widgets.Image(value=image, format='png')
v.Footer( absolute = False,
class_="font-weight-medium",
children= [v.Col(class_="text-center", cols="12", children=[img,'BMW - 2020 - alpha version 0.0. powered by Soft company PPP'])]
)
检查这是否解决了您的问题 对Christoph Weiss-Schabers的回答进行一些修改后,可以使用IPYfutify完成:
import base64
import ipyvuetify as v
file = open( 'LINK_TO_YOUR_ICON', 'rb')
image = file.read()
image_base64 = base64.b64encode(image).decode('ascii')
img = v.Img(src=f'data:image/png;base64,{image_base64}')
v.Footer( absolute = False,
class_="font-weight-medium",
children= [v.Col(class_="text-center", cols="12", children=[img,'BMW - 2020 - alpha version 0.0. powered by Soft company PPP'])]
)
或在线图像:
v、 Imgsrchttps://homepages.cae.wisc.edu/~ece533/images/fruits.png',width='100',height='100'
通过对Christoph Weiss-Schabers答案的一些修改,可以使用IPYfutify完成:
import base64
import ipyvuetify as v
file = open( 'LINK_TO_YOUR_ICON', 'rb')
image = file.read()
image_base64 = base64.b64encode(image).decode('ascii')
img = v.Img(src=f'data:image/png;base64,{image_base64}')
v.Footer( absolute = False,
class_="font-weight-medium",
children= [v.Col(class_="text-center", cols="12", children=[img,'BMW - 2020 - alpha version 0.0. powered by Soft company PPP'])]
)
或在线图像:
v、 Imgsrchttps://homepages.cae.wisc.edu/~ece533/images/fruits.png',width='100',height='100'