ModalView in Kivy

I'm having trouble with Kivy. I'm using a ModalView and I want the background color to be white or the same as the app's main theme. The documentation says: "This acts as a multiplier to the texture color. The default texture is gray, so just setting the background color will give a darker result. To set a plain color, set the background_normal to ''.". But I can't figure out how and where to specify this value. Please tell me how to make the background of ModalView be white or like the main theme.

Tried like this:

view = ModalView(size_hint=(.9, .9), background_normal='.') view.add_widget(Content()) view.open() Got it:

TypeError: Properties ['background_normal'] passed to __init__ may not be existing property names.

Upvotes: 0

Views: 183

Answers (2)

John Anderson
John Anderson

Reputation: 38837

In spite of what the documentation says, I have found this way to set the background color of a ModalView:

    view = ModalView(size_hint=(.9, .9), background='', overlay_color=[1, 1, 1, 1])
    view.add_widget(Content())
    view.open()

Upvotes: 1

To make the ModalView background, for example, white, you need to find an image of a white background (or any other color) and write background = 'PATH' in the ModalView:

view = ModalView(size_hint=(.9, .9), background='PATH') 
view.add_widget(Content())
view.open()

Upvotes: 0

Related Questions