KivyToast¶
Implementation of toasts for desktop.
from kivymd.app import MDApp
from kivymd.toast import toast
KV = '''
BoxLayout:
orientation:'vertical'
MDToolbar:
id: toolbar
title: 'Test Toast'
md_bg_color: app.theme_cls.primary_color
left_action_items: [['menu', lambda x: '']]
FloatLayout:
MDRaisedButton:
text: 'TEST KIVY TOAST'
on_release: app.show_toast()
pos_hint: {'center_x': .5, 'center_y': .5}
'''
class Test(MDApp):
def show_toast(self):
'''Displays a toast on the screen.'''
toast('Test Kivy Toast')
def build(self):
return Builder.load_string(KV)
Test().run()
API - kivymd.toast.kivytoast.kivytoast
¶
-
class
kivymd.toast.kivytoast.kivytoast.
Toast
(**kwargs)¶ Bases:
kivy.uix.modalview.ModalView
-
duration
¶ The amount of time (in seconds) that the toast is visible on the screen.
duration
is anNumericProperty
and defaults to 2.5.
-
label_check_texture_size
(self, instance, texture_size)¶
-
toast
(self, text_toast)¶
-
on_open
(self)¶
-
fade_in
(self)¶
-
fade_out
(self, interval)¶
-
on_touch_down
(self, touch)¶
-
-
kivymd.toast.kivytoast.kivytoast.
toast
(text: str, duration=2.5)¶ Displays a toast.
- Duration
The amount of time (in seconds) that the toast is visible on the screen.