英文:
Change button size in vpython on Pydroid
问题
我在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()
英文:
I have the following code in Pydroid. I creates 3D text in Python on Android. I need to make the button bigger.
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()
答案1
得分: 0
这是对我有效的方法。不是尝试更改按钮及其字体,我发现我可以在按钮文本中注入HTML。
button(bind=capture_scene, text="""<span style="font-size: 63px;"><h1 style="display: inline-block; margin:0; padding:23px;">下载</h1></span>""")
英文:
This is what worked for me. Instead of trying to change the button and its font. I discovered that I could inject html in the button text.
button(bind=capture_scene, text="""<span style="font-size: 63px;"><h1 style="display: inline-block;margin:0;padding:23px;">Download</h1></span>""")
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论