When clear_widgets is called, it doesnt remove screens in ScreenManager

When clear_widgets is called, it doesnt remove screens in ScreenManager

By : Thomas
Date : January 12 2021, 09:11 PM
hope this fix your issue You've discovered a bug in Kivy, ScreenManager.clear_widgets doesn't correctly iterate over the screens.
I've created a pull request to fix this here. It should be included in the next Kivy release.
code :
def clear_widgets(self, screens=None):
    if screens is None:
        screens = self.screens

    for screen in screens[:]:

Share : facebook icon twitter icon
How to reference objects in other screens using kivy screenmanager

How to reference objects in other screens using kivy screenmanager

By : Ola AlYamani
Date : March 29 2020, 07:55 AM
it should still fix some issue You are trying to access ids dictionary, that's nice, yet in a completely different instance, that's why this error:
code :
AttributeError: 'super' object has no attribute '__getattr__'
self.manager.screens[1].sc1log.text = 'Coming from main'
# no ids, because you put it into a variable before
    id: scrmain
            id: mainlog
{'mainlog': <WeakProxy to <kivy.uix.label.Label object at 0x12345678>>}
Kivy ScreenManager switch screens leaving buttons

Kivy ScreenManager switch screens leaving buttons

By : Chantouch Sek
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further in the field of the button the root is NavButtons, and as you can see NavButtons does not have Screens as a children, a way to access Screens is through app.root that returns in this case to AppContainer, we set it up to Screens and we access this because he is a children.
code :
#:import BoxLayout kivy.uix.boxlayout.BoxLayout

        id: sm

        on_press: app.root.ids.sm.current="first"
        text: 'First'
        pos_hint:{"top": 1, "left": 0}
        on_press: app.root.ids.sm.current ="second"
        text: 'Second'
        pos_hint:{"top":0.8, "left": 0}

screenmanager kivy define callback function to switch screens

screenmanager kivy define callback function to switch screens

By : gogo_yubari
Date : March 29 2020, 07:55 AM
To fix this issue Replace ScreenManager().current = "SettingsScreen" with sm.current = "settings" Rename class name from mainwidget to MainWidget (CapWords convention) Example main.py
code :
from kivy.app import App
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.uix.widget import Widget
from kivy.uix.button import Button
from kivy.core.window import Window
from kivy.lang import Builder

#:kivy 1.11.0


            text: 'My settings button'
            text: 'Back to menu'
            on_press: root.manager.current = 'settings'

class MainWidget(Widget):

    def __init__(self, **kwargs):
        super(MainWidget, self).__init__(**kwargs)
        btnnext = Button(text='go to next', pos=(200, 400))

    # def savecard(self, btn_instance):

    def gonext(self ,btn_inst):
        sm.current = "settings"

class MenuScreen(Screen):

class SettingsScreen(Screen):

class ScreenManager(ScreenManager):

# Create the screen manager
sm = ScreenManager()

class TestApp(App):

    def build(self):
        Window.clearcolor = (0,0,0.3,1)
        return sm

if __name__ == '__main__':
Kivy: How do I use layouts within seperate screens while using ScreenManager?

Kivy: How do I use layouts within seperate screens while using ScreenManager?

By : user2623146
Date : March 29 2020, 07:55 AM
I wish this helpful for you Your code is working OK. The image is at the top-right corner.
Your problem is the size of that Image widget. Its as big as the size of the window.
code :
        size_hint: .1, .1
        source: 'settings-cog.png'
Kivy ScreenManager does not switch screens (pure python)

Kivy ScreenManager does not switch screens (pure python)

By : Debendia Oli
Date : March 29 2020, 07:55 AM
around this issue What you must manipulate is screen_manager.current and not screen_manager.current_screen.
You must also refer to the screen by its name.
code :
IMAGE_SIZE = (640, 480)

class MainScreen(Screen):

    def __init__(self, path, **kwargs):
        super(MainScreen, self).__init__(**kwargs)
        Window.size = (IMAGE_SIZE[0], IMAGE_SIZE[1])

        with self.canvas:
            self.bg = Image(source=path)

        self._keyboard = Window.request_keyboard(self._keyboard_closed, self, 'text')


    def update_bg(self, *args):
        self.bg.pos = self.pos
        self.bg.size = self.size

    def _keyboard_closed(self):
        print('My keyboard have been closed!')
        self._keyboard = None

    def _on_keyboard_down(self, keyboard, keycode, text, modifiers):
        if keycode[1] == 'escape':
        if keycode[1] == 'enter':
            print('before enter', screen_manager.current)
            screen_manager.transition.direction = 'left'
            screen_manager.current = "1"
            print('after enter', screen_manager.current)

        return True

screen_manager = None

scree_1 = MainScreen(path_1, name="1")
scree_2 = MainScreen(path_2, name="2")

class MyApp(App):

    def build(self):
        global screen_manager
        screen_manager = ScreenManager()


        return screen_manager

if __name__ == '__main__':
Related Posts Related Posts :
  • Tuning the hyperparameter with gridsearch results in overfitting
  • some coordinates that I extracted from geocoder in Python are not saving in the variable I created
  • 7C in cs circles- python Im not sure what is wrong with this yet
  • How to fix 'AttributeError: 'list' object has no attribute 'shape'' error in python with Tensorflow / Keras when loading
  • python - thread`s target is a method of an object
  • Retrieve Variable From Class
  • What is the reason for matplotlib for printing labels multiple times?
  • Why would people use ThreadPoolExecutor instead of direct function call?
  • Python can't import function
  • Pieces doesn't stack after one loop on my connect4
  • How to change font size of all .docx document with python-docx
  • How to store a word with # in .cfg file
  • How to append dictionaries to a dictionary?
  • How can I scrape text within paragraph tag with some other tags then within the paragraph text?
  • Custom entity ruler with SpaCy did not return a match
  • Logging with two handlers - one to file and one to stderr
  • How to do pivot_table in dask with aggfunc 'min'?
  • This for loop displays only the last entry of the student record
  • How to split a string by a specific pattern in number of characters?
  • Python 3: how to scrape research results from a website using CSFR?
  • Setting the scoring parameter of RandomizedSeachCV to r2
  • How to send alert or message from view.py to template?
  • How to add qml ScatterSeries to existing qml defined ChartView?
  • Django + tox: Apps aren't loaded yet
  • My css and images arent showing in django
  • Probability mass function sum 2 dice roll?
  • Cannot call ubuntu 'ulimit' from python subprocess without using shell option
  • Dataframe Timestamp Filter for new/repeating value
  • Problem with clicking select2 dropdownlist in selenium
  • pandas dataframe masks to write values into new column
  • How to click on item in navigation bar on top of page using selenium python?
  • Add multiple EntityRuler with spaCy (ValueError: 'entity_ruler' already exists in pipeline)
  • error when replacing missing ')' using negative look ahead regex in python
  • Is there a way to remove specific strings from indexes using a for loop?
  • select multiple tags by position in beautifulSoup
  • pytest: getting AttributeError: 'CaptureFixture' object has no attribute 'readouterror' capturing stdout
  • Shipping PyGObject/GTK+ app on Windows with MingW
  • Python script to deduplicate lines in multiple files
  • How to prevent window and widgets in a pyqt5 application from changing size when the visibility of one widget is altered
  • How to draw stacked bar plot from df.groupby('feature')['label'].value_counts()
  • Python subprocess doesn't work without sleep
  • How can I adjust 'the time' in python with module Re
  • Join original np array with resulting np array in a form of dictionary? multidimensional array? etc?
  • Forcing labels on histograms in each individual graph in a figure
  • For an infinite dataset, is the data used in each epoch the same?
  • Is there a more efficent way to extend a string?
  • Is it possible to do this loop in a one-liner?
  • invalid literal for int() with base 10: - django
  • Why does my code print a value that I have not assigned as yet?
  • the collatz func in automate boring stuff with python
  • How to find all possible combinations of parameters and funtions
  • about backpropagation deep neural network in tensorflow
  • Sort strings in pandas
  • How do access my flask app hosted in docker?
  • Replace the sentence include some text with Python regex
  • Counting the most common element in a 2D List in Python
  • logout a user from the system using a function in python
  • mp4 metadata not found but exists
  • Django: QuerySet with ExpressionWrapper
  • Pandas string search in list of dicts
  • shadow
    Privacy Policy - Terms - Contact Us © festivalmusicasacra.org