how to change the application icon of an app in beeware, python

1.4k Views Asked by At

So basically I am creating an app with BeeWare(Python). And I wanted to know whether it is possible to change the default icon of beeware and toga and use my own icons. If it is possible, then please someone provide a solution for it. Thanks.

3

There are 3 best solutions below

0
Anacktice Justice On

If you have made an android app and it is in your PC then to do so you will need winrar application just right click on it and choose open with and select winrar (or whatever unzipping tool you have) and browse to the resources folder and there are many folders there, there in the last 4 to 5 folders there is an image you have to replace them with an image of same format and resolution, if you replace then with some other format or resolution your application would not work.. Thanks

1
sinoroc On

There seems to be an icon configuration setting:

0
André Cerutti Franciscatto On

There is some parameters that can be added to toga.App().

import toga
from toga.style.pack import CENTER, COLUMN, ROW, Pack


class Graze(toga.App):
    def startup(self):
        self._impl.create_menus = lambda *x, **y: None  # if you want to remove menus
        self.main_window = toga.MainWindow(title=self.name)

        self.webview = toga.WebView(on_webview_load=self.on_webview_loaded, style=Pack(flex=1))
        self.url_input = toga.TextInput(
            value='THE URL YOU WANT TO ACCESS',
            style=Pack(flex=1)
        )

        box = toga.Box(
            children=[
                self.webview,
            ],
            style=Pack(
                direction=COLUMN
            )
        )

        self.main_window.content = box
        self.webview.url = self.url_input.value

        # Show the main window
        self.main_window.show()

    def load_page(self, widget):
        self.webview.url = self.url_input.value

    def on_webview_loaded(self, widget):
        self.url_input.value = self.webview.url


def main():
    return Graze(formal_name='YOUR PROGRAM NAME',
                 app_id='YOUR AP ID',
                 app_name='YOUR APP NAME',
                 icon='your_icon.png')


if __name__ == '__main__':
    main().main_loop()