Python | Popup widget in Kivy Last Updated : 06 Feb, 2020 Comments Improve Suggest changes Like Article Like Report Kivy is a platform independent GUI tool in Python. As it can be run on Android, IOS, linux and Windows etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications. 👉🏽 Kivy Tutorial - Learn Kivy with Examples. Popup widget : The Popup widget is used to create popups. By default, the popup will cover the whole “parent” window. When you are creating a popup, you must at least set a Popup.title and Popup.content. Popup dialogs are used ]when we have to convey certain obvious messages to the user. Messages to the user through status bars as well for specific messages which need to be told with emphasis can still be done through popup dialogs. Keep one thing in mind that the default size of a widget is size_hint=(1, 1). If you don't want your popup to be on the full screen you must gave either size hints with values less than 1 (for instance size_hint=(.8, .8)) or deactivate the size_hint and use fixed size attributes. To use popup you must have to import : from kivy.uix.popup import Popup Note: Popup is a special widget. Don’t try to add it as a child to any other widget. If you do, Popup will be handled like an ordinary widget and won’t be created hidden in the background. Basic Approach : 1) import kivy 2) import kivyApp 3) import Label 4) import button 5) import Gridlayout 6) import popup 7) Set minimum version(optional) 8) create App class 9) return Layout/widget/Class(according to requirement) 10) In the App class create the popup 11) Run an instance of the class Code #1: In the first code the popup will cover the whole “parent” window. Python3 # Kivy example for the Popup widget # Program to Show how to create a switch # import kivy module import kivy # base Class of your App inherits from the App class. # app:always refers to the instance of your application from kivy.app import App # this restrict the kivy version i.e # below this kivy version you cannot # use the app or software kivy.require('1.9.0') # The Button is a Label with associated actions # that is triggered when the button # is pressed (or released after a click/touch). from kivy.uix.button import Button # The GridLayout arranges children in a matrix. # It takes the available space and # divides it into columns and rows, # then adds widgets to the resulting “cells”. from kivy.uix.gridlayout import GridLayout # Popup widget is used to create popups. # By default, the popup will cover # the whole “parent” window. # When you are creating a popup, # you must at least set a Popup.title and Popup.content. from kivy.uix.popup import Popup # The Label widget is for rendering text. from kivy.uix.label import Label # to change the kivy default settings we use this module config from kivy.config import Config # 0 being off 1 being on as in true / false # you can use 0 or 1 && True or False Config.set('graphics', 'resizable', True) # Make an app by deriving from the kivy provided app class class PopupExample(App): # override the build method and return the root widget of this App def build(self): # Define a grid layout for this App self.layout = GridLayout(cols = 1, padding = 10) # Add a button self.button = Button(text ="Click for pop-up") self.layout.add_widget(self.button) # Attach a callback for the button press event self.button.bind(on_press = self.onButtonPress) return self.layout # On button press - Create a popup dialog with a label and a close button def onButtonPress(self, button): layout = GridLayout(cols = 1, padding = 10) popupLabel = Label(text = "Click for pop-up") closeButton = Button(text = "Close the pop-up") layout.add_widget(popupLabel) layout.add_widget(closeButton) # Instantiate the modal popup and display popup = Popup(title ='Demo Popup', content = layout) popup.open() # Attach close button press with popup.dismiss action closeButton.bind(on_press = popup.dismiss) # Run the app if __name__ == '__main__': PopupExample().run() Output: When click on screen popup will open like this: When click on Close the popup it will close. Code #2: In the second code when we use the size_hint and the size we can give the size accordingly. In this just add something as in the below code in line number 75. Python3 # Kivy example for the Popup widget # Program to Show how to create a switch # import kivy module import kivy # base Class of your App inherits from the App class. # app:always refers to the instance of your application from kivy.app import App # this restrict the kivy version i.e # below this kivy version you cannot # use the app or software kivy.require('1.9.0') # The Button is a Label with associated actions # that is triggered when the button # is pressed (or released after a click/touch). from kivy.uix.button import Button # The GridLayout arranges children in a matrix. # It takes the available space and # divides it into columns and rows, # then adds widgets to the resulting “cells”. from kivy.uix.gridlayout import GridLayout # Popup widget is used to create popups. # By default, the popup will cover # the whole “parent” window. # When you are creating a popup, # you must at least set a Popup.title and Popup.content. from kivy.uix.popup import Popup # The Label widget is for rendering text. from kivy.uix.label import Label # to change the kivy default settings we use this module config from kivy.config import Config # 0 being off 1 being on as in true / false # you can use 0 or 1 && True or False Config.set('graphics', 'resizable', True) # Make an app by deriving from the kivy provided app class class PopupExample(App): # override the build method and return the root widget of this App def build(self): # Define a grid layout for this App self.layout = GridLayout(cols = 1, padding = 10) # Add a button self.button = Button(text ="Click for pop-up") self.layout.add_widget(self.button) # Attach a callback for the button press event self.button.bind(on_press = self.onButtonPress) return self.layout # On button press - Create a popup dialog with a label and a close button def onButtonPress(self, button): layout = GridLayout(cols = 1, padding = 10) popupLabel = Label(text = "Click for pop-up") closeButton = Button(text = "Close the pop-up") layout.add_widget(popupLabel) layout.add_widget(closeButton) # Instantiate the modal popup and display popup = Popup(title ='Demo Popup', content = layout, size_hint =(None, None), size =(200, 200)) popup.open() # Attach close button press with popup.dismiss action closeButton.bind(on_press = popup.dismiss) # Run the app if __name__ == '__main__': PopupExample().run() Output: Popup size will be smaller than the window size. Reference : https://kivy.org/doc/stable/api-kivy.uix.popup.html Comment More infoAdvertise with us Next Article Python | Switch widget in Kivy Y YashKhandelwal8 Follow Improve Article Tags : Python Python-gui Python-kivy Practice Tags : python Similar Reads Kivy Tutorial Kivy is an opensource Python library that allows you to develop multi-platform graphical user interface applications on Windows, macOS, Android, iOS, Linux, and Raspberry-Pi. In addition to regular mouse and keyboard inputs, it supports multitouch events. Applications made using Kivy will appear sim 3 min read Introduction to KivyIntroduction to Kivy ; A Cross-platform Python FrameworkKivy is an open-source, cross-platform Python framework used for developing multi-touch applications with a natural user interface. It allows developers to build applications that run on multiple platforms, including Windows, macOS, Linux, iOS, and Android. Kivy is based on the Model-View-Controller 4 min read Creating your first application using KivyPrerequisites: Introduction to Kivy, Hello World in Kivy Kivymd is graphical user interface library in python based on kivy that allows you to develop multi-platform applications on Windows, MacOS, Android, iOS, Linux, and Raspberry Pi. The best thing about kivy is, it performs better than HTML5 cro 2 min read Kivy WidgetsPython | Add Label to a kivy windowKivy is a platform-independent GUI tool in Python. As it can be run on Android, iOS, Linux and Windows, etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktop applications.Label widget - The Label widget is for rendering text. It support 4 min read Python | Textinput widget in kivyKivy is a platform-independent GUI tool in Python. As it can be run on Android, IOS, linux and Windows etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications. 👉🏽 Kivy Tutorial - Learn Kivy with Examples. Tex 3 min read Python | Checkbox widget in KivyKivy is a platform independent GUI tool in Python. Kivy applications can be run on Android, IOS, linux, and Windows, etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktop applications. Kivy Tutorial - Learn Kivy with Examples. Checkbox 4 min read Python | Dropdown list in kivyKivy is a platform independent GUI tool in Python. As it can be run on Android, IOS, linux and Windows etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications. ???????? Kivy Tutorial - Learn Kivy with Examples. Dropdown list 3 min read Python | Window size Adjustment in KivyKivy is a platform independent GUI tool in Python. As it can be run on Android, IOS, linux and Windows etc. Kivy provides you the functionality to write the code for once and run it on different platforms. It is basically used to develop the Android application, but it does not mean that it can not 4 min read Python | Scrollview widget in kivyKivy is a platform-independent GUI tool in Python. As it can be run on Android, IOS, Linux, and Windows, etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktop applications.  Kivy Tutorial - Learn Kivy with Examples. Scroll view: The Scr 3 min read Python | Carousel Widget In KivyKivy is a platform independent GUI tool in Python. As it can be run on Android, IOS, linux and Windows etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications. 👉🏽 Kivy Tutorial - Learn Kivy with Examples. Car 3 min read Python | BoxLayout widget in KivyKivy is a platform independent GUI tool in Python. As it can be run on Android, IOS, Linux and Windows, etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications. ???????? Kivy Tutorial - Learn Kivy with Examples. Now in this 5 min read Python | Slider widget in KivyKivy is a platform independent GUI tool in Python. As it can be run on Android, IOS, linux and Windows etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications. ???????? Kivy Tutorial - Learn Kivy with Examples. Slider: To w 4 min read Python | Add image widget in KivyKivy is a platform-independent GUI tool in Python. As it can be run on Android, IOS, Linux and Windows, etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktop applications. ?? Kivy Tutorial - Learn Kivy with Examples. Image Widget: The I 4 min read Python | Popup widget in KivyKivy is a platform independent GUI tool in Python. As it can be run on Android, IOS, linux and Windows etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications. 👉🏽 Kivy Tutorial - Learn Kivy with Examples. Pop 6 min read Python | Switch widget in KivyKivy is a platform independent GUI tool in Python. As it can be run on Android, IOS, linux and Windows etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications. ???????? Kivy Tutorial - Learn Kivy with Examples. Switch widget 5 min read Python | Spinner widget in kivyKivy is a platform independent GUI tool in Python. As it can be run on Android, IOS, linux and Windows etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications. 👉🏽 Kivy Tutorial - Learn Kivy with Examples. Spi 5 min read Python | Progress Bar widget in kivyKivy is a platform-independent GUI tool in Python. As it can be run on Android, IOS, linux and Windows etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications. 👉🏽 Kivy Tutorial - Learn Kivy with Examples. Pro 4 min read Python | Bubble in kivyKivy is a platform independent GUI tool in Python. As it can be run on Android, IOS, linux and Windows etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications. 👉🏽 Kivy Tutorial - Learn Kivy with Examples. Bub 3 min read Python | Tabbed panel in kivyKivy is a platform independent GUI tool in Python. As it can be run on Android, IOS, linux and Windows etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications 👉🏽 Kivy Tutorial - Learn Kivy with Examples. Tabb 2 min read Python | Scatter in kivyKivy is a platform independent GUI tool in Python. As it can be run on Android, IOS, linux and Windows etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications. 👉🏽 Kivy Tutorial - Learn Kivy with Examples. Sca 3 min read How to use multiple UX Widgets in kivy | PythonKivy is a platform-independent GUI tool in Python. As it can be run on Android, IOS, linux and Windows etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications. ???????? Kivy Tutorial - Learn Kivy with Examples. UX Widgets: C 3 min read ButtonsPython | Working with buttons in KivyKivy is a platform-independent GUI tool in Python as it can be run on Android, IOS, Linux Windows, etc. Kivy provides you the functionality to write the code for once and run it on different platforms. It is basically used to develop the Android application, but it does not mean that it can not be u 5 min read Python | Button Action in KivyKivy is a platform-independent GUI tool in Python. As it can be run on Android, IOS, Linux and Windows, etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktop applications. ???????? Kivy Tutorial - Learn Kivy with Examples. Now in this a 3 min read Change button Color in KivyKivy is a platform independent GUI tool in Python. As it can be run on Android, IOS, Linux and Windows, etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications. In this article, we will learn about how to change the button c 3 min read Change the size and position of button in KivyKivy is a platform independent GUI tool in Python. As it can be run on Android, IOS, linux and Windows etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications.In this article, we will see that how can we can change the size 4 min read Python - Rounding button corners in kivyKivy is a platform-independent GUI tool in Python. As it can be run on Android, IOS, Linux and Windows, etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktop applications. In this article we will be going to learn how to round the butto 4 min read Disable Kivy ButtonIn this article, we will learn how to disable a button in kivy, there are some places where we need to disable the buttons So in this article you will learn how to do that. Kivy Tutorial â Learn Kivy with Examples. The Button is a Label with associated actions that are triggered when the button is p 3 min read Text Input box with a verification button in kivyKivy is a platform-independent GUI tool in Python. As it can be run on Android, IOS, linux and Windows etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications. In this article we will learn how we can add a button with the T 3 min read Use image as a button in kivyKivy is a platform independent GUI tool in Python. As it can be run on Android, IOS, linux and Windows etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications. As we have discussed earlier that how to work with images and no 5 min read LayoutsPython | Float Layout in KivyKivy is a platform independent GUI tool in Python. As it can be run on Android, IOS, linux and Windows etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications. ?? Kivy Tutorial - Learn Kivy with Examples. FloatLayout: Floatl 5 min read GridLayouts in Kivy | PythonKivy is a platform independent as it can be run on Android, IOS, Linux and Windows, etc. Kivy provides you the functionality to write the code for once and run it on different platforms. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktop 3 min read Python | StackLayout in KivyKivy is a platform independent GUI tool in Python. As it can be run on Android, IOS, linux and Windows etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications. ???????? Kivy Tutorial - Learn Kivy with Examples.  StackLayou 3 min read Python| AnchorLayout in KivyKivy is a platform independent GUI tool in Python. As it can be run on Android, IOS, linux and Windows etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications. 👉🏽 Kivy Tutorial - Learn Kivy with Examples. Anc 3 min read Python | Relative Layout in KivyKivy is a platform-independent GUI tool in Python. As it can be run on Android, IOS, Linux and Windows, etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktop applications. Kivy Tutorial - Learn Kivy with Examples. Relative Layout:Relat 5 min read Python | PageLayout in KivyKivy is a platform independent GUI tool in Python. As it can be run on Android, IOS, linux, and Windows, etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications. Kivy Tutorial - Learn Kivy with Examples. PageLayout: The Page 4 min read Python | Layouts in layouts (Multiple Layouts) in KivyKivy is a platform independent GUI tool in Python. As it can be run on Android, IOS, linux and Windows etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications.In this article, we are going to discuss how we can use layouts i 5 min read Graphics and AnimationPython | Animation in KivyKivy is a platform independent GUI tool in Python. As it can be run on Android, IOS, Linux and Windows, etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications. ?? Kivy Tutorial - Learn Kivy with Examples.Animation: Animatio 2 min read Python | Animation in Kivy using .kv fileKivy is a platform independent GUI tool in Python. As it can be run on Android, IOS, Linux, and Windows, etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications. Animation: Animation and AnimationTransition are used to anima 3 min read Animated Floating Action Button in kivy - PythonKivy is a platform independent GUI tool in Python. As it can be run on Android, IOS, linux and Windows etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications.In this article we will learn about how can we Add the Animation 4 min read Python | Line (Canvas) in kivyKivy is a platform independent GUI tool in Python. As it can be run on Android, IOS, linux, and Windows, etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications. Kivy Tutorial - Learn Kivy with Examples. Line canvas: Line is 4 min read Python | Canvas in kivyKivy is a platform independent GUI tool in Python. As it can be run on Android, IOS, linux and Windows etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications. ???????? Kivy Tutorial - Learn Kivy with Examples. Canvas: The 4 min read Python | Ellipse (different polygons) in KivyKivy is a platform independent GUI tool in Python. As it can be run on Android, IOS, linux and Windows, etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications. Kivy Tutorial - Learn Kivy with Examples. Ellipse: Ellipse is a 4 min read Circular (Oval like) button using canvas in kivy (using .kv file)Kivy is a platform independent GUI tool in Python. As it can be run on Android, IOS, linux and Windows etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications.In this article we will going to learn about how can we create a 3 min read User Interfaces and NavigationHow to Create Bottom Navigation using Kivymd and PythonIn this article, we will see how to add the Bottom Navigation in our application using KivyMD in Python. Installation: To install this module type the below command in the terminal. pip install kivy pip install kivymd MDBottomNavigation Method:  Bottom navigation is used to navigate from one screen 5 min read Python | ScreenManager in Kivy using .kv fileKivy is a platform independent GUI tool in Python. As it can be run on Android, IOS, linux and Windows etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications. ScreenManager widget : The screen manager is a widget which is 6 min read File I/O and MultimediaPython | Adding image in Kivy using .kv fileKivy is a platform independent GUI tool in Python. As it can be run on Android, IOS, linux, and Windows, etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications. Kivy Tutorial - Learn Kivy with Examples. Image Widget: The Im 4 min read Python - Add audio files in kivyKivy is a platform independent GUI tool in Python. Kivy is a tool used to build cross-platform applications in Python which can run on android, IOS, Linux, Windows. Audio Widget: This module is used to load audio files in kivy. from kivy.core.audio import SoundLoader Below is the code on how you can 1 min read Applications and ProjectsPython | Make a simple window using kivyKivy is a platform independent as it can be run on Android, IOS, linux and Windows etc. Kivy provides you the functionality to write the code for once and run it on different platforms. It is basically used to develop the Android application, but it Does not mean that it can not be used on Desktops 5 min read Python | Vkeyboard (virtual keyboard) in kivyKivy is a platform independent GUI tool in Python. As it can be run on Android, IOS, linux and Windows etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications. Vkeyboard: VKeyboard is an onscreen keyboard for Kivy. Its opera 2 min read Python | Multiple Sliders widgets Controlling Background Screen or WindowColor in KivyPrerequisite - Slider in KivyKivy is a platform independent GUI tool in Python. As it can be run on Android, IOS, linux and Windows etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications.In this article, we will learn How w 3 min read Python | How to use Multiple kv files in kivyKivy is a platform independent GUI tool in Python. As it can be run on Android, IOS, linux and Windows etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications. In this article, we will see how can we use multiple .kv files i 3 min read Python | Accordion in kivyKivy is a platform independent GUI tool in Python. As it can be run on Android, IOS, linux and Windows etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications. Kivy Tutorial - Learn Kivy with Examples. Accordion: The Accordi 3 min read Python | Accordion in kivy using .kv fileKivy is a platform independent GUI tool in Python. As it can be run on Android, IOS, linux and Windows etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications. ???????? Kivy Tutorial - Learn Kivy with Examples. Accordion: Th 2 min read Python | Creating a Simple Drawing App in kivyKivy is a platform-independent GUI tool in Python. As it can be run on Android, IOS, Linux and Windows, etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktop applications. Kivy Tutorial - Learn Kivy with Examples. Drawing App: In this w 4 min read Python | File chooser in kivyKivy is a platform independent GUI tool in Python. As it can be run on Android, IOS, linux, and Windows, etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications. Kivy Tutorial - Learn Kivy with Examples. Filechooser: The Fil 2 min read How to make calculator using kivy | PythonKivy is a platform-independent GUI tool in Python. As it can be run on Android, IOS, linux and Windows etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications. ???????? Kivy Tutorial - Learn Kivy with Examples. In this artic 3 min read Python | Create a stopwatch using clock object in kivy using .kv fileKivy is a platform-independent GUI tool in Python. As it can be run on Android, IOS, Linux and Windows, etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktop applications. Kivy Tutorial - Learn Kivy with Examples. Clock Object: The Cloc 6 min read Python | Create a stopwatch Using Clock Object in kivyKivy is a platform-independent GUI tool in Python. As it can be run on Android, IOS, Linux and Windows, etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktop applications.In this, we are going to see how can we create a stopwatch using 4 min read Like