Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MDDialog with custom bg color disappears when using @mainthread #1681

Open
cdavidson-project-canary opened this issue Apr 17, 2024 · 1 comment

Comments

@cdavidson-project-canary

Description of the Bug

When utilizing the @mainthread decorator to open a MDDialog with a custom background color, the dialog background will go transparent when mousing over and then mousing off the dialog without clicking anything.

I found a way to workaround this by overriding the set_properties_widget() method in my custom dialog class that inherits from MDDialog. This overridden method is defined in kivymd/uix/behaviors/state_layer_behavior.py.

Note: the example below is simplified - in my usage a separate thread is invoking the open_dialog_in_mainthread() method.

Code and Logs

from kivy.clock import mainthread

from kivymd.app import MDApp
from kivymd.uix.dialog import MDDialog
from kivymd.uix.screen import MDScreen

class TestApp(MDApp):

    def build(self):
        screen = MDScreen()
        self.dialog = MDDialog(theme_bg_color="Custom", md_bg_color="yellow")
        self.open_dialog_in_mainthread()
        return screen
    #
    
    #@mainthread
    def open_dialog_in_mainthread(self):
        self.dialog.open()
    #
#

app = TestApp()
app.run()

Versions

  • OS: Windows 11 Enterprise
  • Python: 3.10.11
  • Kivy: 2.3.0
  • KivyMD: 2.0.1.dev0
@HeaTTheatR
Copy link
Member

This is fixed in my local repository

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants