在 Pydroid 上的 vpython 中更改按钮大小

Change button size in vpython on Pydroid

提问人:Hassan Voyeau 提问时间:5/21/2023 最后编辑:Hassan Voyeau 更新时间:5/22/2023 访问量:45

问:

我在 Pydroid 中有以下代码。我在 Android 上用 Python 创建 3D 文本。我需要把按钮变大。

import asyncio
from vpython import *

scene = canvas()

scene.width = 1600
scene.height = 1600

text(text = "Hello World", align = "center")

def capture_scene():
    img = scene.capture("image")

button(bind=capture_scene, text='Download')

asyncio.get_event_loop().run_forever()
vpython pydroid

评论

0赞 Hassan Voyeau 5/22/2023
asyncio 代码用于此错误,以防有人在互联网上搜索 - “关闭后无法安排新的期货”

答:

0赞 Hassan Voyeau 5/22/2023 #1

这就是对我有用的东西。而不是尝试更改按钮及其字体。我发现我可以在按钮文本中注入html。

button(bind=capture_scene, text="""<span style="font-size: 63px;"><h1 style="display: inline-block;margin:0;padding:23px;">Download</h1></span>""")