I am making a desktop application using kivy & kivymd and when creating the settings screen for the app I used two MDRectangleFlatButon and MDRaisedButtons but to make them scalable, I gave both of them a size_hint_x of .5 for each to take up half of the screen. However, as soon as the program starts I get this warning from kivy:
[CRITICAL] [Clock ] Warning, too much iteration done before the next frame. Check your code, or increase the Clock.max_iteration attribute
the interesting part is that if I switch the current screen to the one that I defined them inside of it, the warning stops. Why am I getting this warning and how can I stop it? My python file:
from kivy.config import Config
Config.set('graphics', 'width', '850')
Config.set('graphics', 'height', '530')
Config.set('graphics', 'minimum_width', '850')
Config.set('graphics', 'minimum_height', '530')
from kivy.lang import Builder
from kivymd.uix.card import MDCard
from kivymd.uix.tab import MDTabsBase
from kivymd.app import MDApp
class SettingsTab(MDCard, MDTabsBase):
pass
class Example(MDApp):
def __init__(self, **kwargs):
super(Example, self).__init__(**kwargs)
self.kv = Builder.load_file("design.kv")
def build(self):
self.theme_cls.theme_style = "Dark"
self.theme_cls.primary_palette = "Blue"
self.theme_cls.accent_palette = "Teal"
return self.kv
if __name__ == '__main__':
Example().run()
My kv file:
#:kivy 2.0.0
<SettingsTab>:
orientation: "vertical"
size_hint: .95, .95
pos_hint: {"center_x": .5, "center_y": .5}
border_radius: 5
radius: [5]
elevation: 20
BoxLayout:
MDNavigationRail:
color_active: app.theme_cls.primary_color
MDNavigationRailItem:
icon: "list-status"
on_release:
screens.current = "downloads_screen"
MDNavigationRailItem:
icon: "cog"
on_release:
screens.current = "settings"
MDNavigationRailItem:
icon: "information"
on_release:
screens.current = "activity_log"
ScreenManager:
id: screens
Screen:
name: "downloads_screen"
Screen:
name: "activity_log"
Screen:
name: "settings"
MDTabs:
SettingsTab:
title: "DOWNLOAD"
SettingsTab:
title: "COLOR"
MDBoxLayout:
adaptive_height: True
orientation: "vertical"
padding: 10
MDLabel:
text: "Theme Manager: "
font_style: "H5"
padding_y: 10
size_hint_y: None
height: self.texture_size[1]
MDBoxLayout:
adaptive_height: True
spacing: 10
MDRectangleFlatButton:
text: "See Current Palette"
size_hint_x: .5
MDRaisedButton:
text: "Open Theme Picker"
size_hint_x: .5
SettingsTab:
title: "INFO"
EDIT: Just to mention, I do not just want the warning go away, I want to stop the performance drop. Even if I didn't add size_hint to any of the buttons (which doesn't cause the error anymore), the app becomes very sluggish and slow. When resizing the program there is a huge delay and when the program starts it is really doing a number on my cpu and it won't change until I switch to that frame.