![](/img/trans.png)
[英]Intermittent KeyError with Dash-Plotly Python app deployed to Heroku
[英]Dash-plotly deployed as an apk for android or IOS
有沒有辦法為android或IOS創建一個dash-plotly應用程序? 我已經閱讀了一些Beeware文檔,但我仍然不知道如何使用我的儀表板並將其包含到 app.py 默認文件中:
import toga
from toga.style import Pack
from toga.style.pack import COLUMN, ROW
class Matics(toga.App):
def startup(self):
"""
Construct and show the Toga application.
Usually, you would add your application to a main content box.
We then create a main window (with a name matching the app), and
show the main window.
"""
main_box = toga.Box()
self.main_window = toga.MainWindow(title=self.formal_name)
self.main_window.content = main_box
self.main_window.show()
def main():
return Matics()
他們提供的示例是具有以下代碼的 Hello world 應用程序:
class HelloWorld(toga.App):
def startup(self):
main_box = toga.Box(style=Pack(direction=COLUMN))
name_label = toga.Label(
'Your name: ',
style=Pack(padding=(0, 5))
)
self.name_input = toga.TextInput(style=Pack(flex=1))
name_box = toga.Box(style=Pack(direction=ROW, padding=5))
name_box.add(name_label)
name_box.add(self.name_input)
button = toga.Button(
'Say Hello!',
on_press=self.say_hello,
style=Pack(padding=5)
)
main_box.add(name_box)
main_box.add(button)
self.main_window = toga.MainWindow(title=self.formal_name)
self.main_window.content = main_box
self.main_window.show()
def say_hello(self, widget):
print("Hello", self.name_input.value)
我還沒有找到在 main_box 中包含虛線代碼的方法。
我的目標是將儀表板作為 android 的 APK,所以如果 beeware 不是解決方案,我很樂意看到解決方案是什么。
要將公文包代碼部署到 apk 中,首先在項目目錄中打開命令提示符,然后在命令窗口中鍵入:
briefcase create android
然后在完成所有工作后輸入:
briefcase build android
然后需要幾分鍾,然后將創建您的 apk 並為此創建一個 iOS 應用程序,您需要和 Mac PC 和命令相同,但您只需將 android 替換為 iOS ..謝謝
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.