Skip to main content

Native toast for android with python

Project description

Toast Android

Module that allows you to create a native toast for android with python, this module must be used with pydroid3, kivy and kivymd, you can create a kivy app and use toast_android,This module allows you to change the position of the toast to wherever you want with just passing some parameters, you can also choose the duration of the toast, below you will see an example of use.

Example:

 from androidtoast import toast
 from kivymd.app import MDApp
 from kivy.lang import Builder
 from kivy.uix.screenmanager import ScreenManager
 from kivymd.uix.screen import MDScreen




 Builder.load_string('''
 <Example>

     MDFlatButton:
         text:"My Toast"
         pos_hint:{"center_x": .5, "center_y": .05}
         on_press:root.show_toast()
 ''')


 class Example(MDScreen):     
     def show_toast(self):
         toast("hello world", True, 80, 200, 0) 



 class Iniciar(MDApp):     
     def build(self):
         pantalla = ScreenManager()
         screen = Example(name="one")
         pantalla.add_widget(screen)
         return pantalla

 Iniciar().run() 

Indications:

"""
    :param text: text to be displayed in the toast;
    :param short_duration:  duration of the toast, if `True` the toast
           will last 2.3s but if it is `False` the toast will last 3.9s;
    :param gravity: refers to the toast position, if it is 80the toast will
           be shown below, if it is 40 the toast will be displayed above;
    :param y: refers to the vertical position of the toast;
    :param x: refers to the horizontal position of the toast;

    Important: if only the text value is specified and the value of
    the `gravity`, `y`, `x` parameters is not specified, their values ​​will
    be 0 which means that the toast will be shown in the center.
    """

This example can be used in Pydroid3 and in a kivy / kivymd app

installation:

pip3 install android-toast

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

android_toast-0.1.0.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

android_toast-0.1.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file android_toast-0.1.0.tar.gz.

File metadata

  • Download URL: android_toast-0.1.0.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.8.0 tqdm/4.51.0 CPython/3.9.0+

File hashes

Hashes for android_toast-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cc6a4391ad424ef29fb93b1cb8c30a61c1456e20eac05404b707fac83232337d
MD5 82437cd46f2c0f64e34ba4fc70be10bd
BLAKE2b-256 e0289b84153741ceb79bdad334f9f6bdc7b93a11cfbb1b8534d0882b769bd7e5

See more details on using hashes here.

File details

Details for the file android_toast-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: android_toast-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.8.0 tqdm/4.51.0 CPython/3.9.0+

File hashes

Hashes for android_toast-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 40c8c4ff58bf22d4c7bd014dd11f7b1d1e55e81235a1027c4e527b4ecbaade8d
MD5 a4aae84fca3e6c540bd89f7183c5c3bf
BLAKE2b-256 7757811efe17c7bc6d1475fe919579d32e907b6b716b45861a868e228b9a67bf

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page