Version

Quick search

Table Of Contents

Inspector

New in version 1.0.9.

Warning

This module is highly experimental, use it with care.

The Inspector is a tool for finding a widget in the widget tree by clicking or tapping on it. Some keyboard shortcuts are activated:

  • “Ctrl + e”: activate / deactivate the inspector view

  • “Escape”: cancel widget lookup first, then hide the inspector view

Available inspector interactions:

  • tap once on a widget to select it without leaving inspect mode

  • double tap on a widget to select and leave inspect mode (then you can manipulate the widget again)

Some properties can be edited live. However, due to the delayed usage of some properties, it might crash if you don’t handle all the cases.

Usage

For normal module usage, please see the modules documentation.

The Inspector, however, can also be imported and used just like a normal python module. This has the added advantage of being able to activate and deactivate the module programmatically:

from kivy.core.window import Window
from kivy.app import App
from kivy.uix.button import Button
from kivy.modules import inspector

class Demo(App):
    def build(self):
        button = Button(text="Test")
        inspector.create_inspector(Window, button)
        return button

Demo().run()

To remove the Inspector, you can do the following:

inspector.stop(Window, button)
kivy.modules.inspector.create_inspector(win, ctx, *largs)[source]

Create an Inspector instance attached to the ctx and bound to the Window’s on_keyboard() event for capturing the keyboard shortcut.

Parameters
win: A Window

The application Window to bind to.

ctx: A Widget or subclass

The Widget to be inspected.

kivy.modules.inspector.stop(win, ctx)[source]

Stop and unload any active Inspectors for the given ctx.