【问题标题】:Dash-plotly deployed as an apk for android or IOSDash-plotly 部署为 android 或 IOS 的 apk
【发布时间】:2021-01-16 15:19:40
【问题描述】:

有没有办法为 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 中的方法。

我的目标是将仪表板作为 APK 用于 android,所以如果 beeware 不是解决方案,我很乐意看到解决方案是什么。

【问题讨论】:

    标签: python plotly-dash beeware


    【解决方案1】:

    要将公文包代码部署到 apk 中,首先在项目目录中打开命令提示符,然后在命令窗口中键入:

    briefcase create android
    

    然后在它完成所有工作之后输入:

    briefcase build android
    

    然后这将需要几分钟,然后您的 apk 将被创建并为此创建一个您需要的 iOS 应用程序,Mac PC 和命令是相同的,但您只需将 android 替换为 iOS.. 谢谢

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-04-08
      • 1970-01-01
      • 2020-08-22
      • 1970-01-01
      • 2021-12-04
      • 1970-01-01
      • 2022-08-19
      • 1970-01-01
      相关资源
      最近更新 更多