<i id='9w2aN'><tr id='9w2aN'><dt id='9w2aN'><q id='9w2aN'><span id='9w2aN'><b id='9w2aN'><form id='9w2aN'><ins id='9w2aN'></ins><ul id='9w2aN'></ul><sub id='9w2aN'></sub></form><legend id='9w2aN'></legend><bdo id='9w2aN'><pre id='9w2aN'><center id='9w2aN'></center></pre></bdo></b><th id='9w2aN'></th></span></q></dt></tr></i><div id='9w2aN'><tfoot id='9w2aN'></tfoot><dl id='9w2aN'><fieldset id='9w2aN'></fieldset></dl></div>

    <legend id='9w2aN'><style id='9w2aN'><dir id='9w2aN'><q id='9w2aN'></q></dir></style></legend>

    1. <small id='9w2aN'></small><noframes id='9w2aN'>

      • <bdo id='9w2aN'></bdo><ul id='9w2aN'></ul>
    2. <tfoot id='9w2aN'></tfoot>

      如何在kivy中更改弹出颜色

      时间:2023-06-07
      <i id='9XJf9'><tr id='9XJf9'><dt id='9XJf9'><q id='9XJf9'><span id='9XJf9'><b id='9XJf9'><form id='9XJf9'><ins id='9XJf9'></ins><ul id='9XJf9'></ul><sub id='9XJf9'></sub></form><legend id='9XJf9'></legend><bdo id='9XJf9'><pre id='9XJf9'><center id='9XJf9'></center></pre></bdo></b><th id='9XJf9'></th></span></q></dt></tr></i><div id='9XJf9'><tfoot id='9XJf9'></tfoot><dl id='9XJf9'><fieldset id='9XJf9'></fieldset></dl></div>
      <tfoot id='9XJf9'></tfoot>

            <bdo id='9XJf9'></bdo><ul id='9XJf9'></ul>

                  <tbody id='9XJf9'></tbody>

                <small id='9XJf9'></small><noframes id='9XJf9'>

                <legend id='9XJf9'><style id='9XJf9'><dir id='9XJf9'><q id='9XJf9'></q></dir></style></legend>
              1. 本文介绍了如何在kivy中更改弹出颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                在 Kivy 中,Popup 显示为灰色,应该更改什么使其变为红色

                In Kivy, Popup appears in grey color, what should be changed to make it red color

                我的弹出代码:

                class MyPopup(Popup):
                    def show_popup(self):
                        content = BoxLayout(orientation="vertical")
                        content.add_widget(Label(text="Game Over", font_size=20))
                        mybutton_cancel = Button(text="Cancel", size_hint_y=None)
                        content.add_widget(mybutton_cancel)
                
                        mypopup = Popup(content = content,              
                            title = "oops", 
                            auto_dismiss = False,         
                            size_hint = (.5, .5))
                        mybutton_cancel.bind(on_release=mypopup.dismiss)
                        mypopup.open()
                

                我希望,很明显我在谈论弹出颜色,而不是弹出窗口或弹出文本颜色后面的背景屏幕颜色.我说的是弹出矩形的颜色.请指教.

                I hope , it is clear that i am talking about popup color and not color of background screen behind popup or popup text color. I am talking about the color of popup rectangle. Please advice.

                推荐答案

                Popup 作为 ModalView 的子项,有一个名为 StringProperty>background,它指向来自 atlas 的图像.默认的是 atlas://data/images/defaulttheme/modalview-background.在这里,我将其更改为默认按钮图像之一:

                Popup as a child of ModalView has a StringProperty called background, which points to an image from at atlas. The default one is atlas://data/images/defaulttheme/modalview-background. Here I changed it to one of the default button images:

                from kivy.app import App
                from kivy.uix.button import Button
                from kivy.uix.popup import Popup
                from kivy.uix.label import Label
                
                class TestApp(App):
                    def build(self):
                        return  Button(text="show", on_press=self.anim_btn)
                
                    def anim_btn(self, *args):
                        popup = Popup(title='Test popup', 
                            content=Label(text='Hello world'), 
                            size_hint=(None, None), 
                            size=(400, 400),
                            background = 'atlas://data/images/defaulttheme/button_pressed'
                        ).open()
                
                if __name__ == "__main__":
                    TestApp().run()
                

                此默认主题位于此处:https://github.com/kivy/kivy/blob/master/kivy/data/images/defaulttheme-0.png 为了自定义您的弹出窗口(以及例如按钮),您可以创建自己的图集(http://kivy.org/docs/api-kivy.atlas.html).

                This default theme resides here: https://github.com/kivy/kivy/blob/master/kivy/data/images/defaulttheme-0.png In order to customize your popup (and also, for example, buttons) you can create your own atlas (http://kivy.org/docs/api-kivy.atlas.html).

                这篇关于如何在kivy中更改弹出颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:如何在 kivy python 中使用滚动条 下一篇:使用 buildozer 构建后,kivy 应用程序中的文件路径无效

                相关文章

                <small id='lUOP9'></small><noframes id='lUOP9'>

              2. <i id='lUOP9'><tr id='lUOP9'><dt id='lUOP9'><q id='lUOP9'><span id='lUOP9'><b id='lUOP9'><form id='lUOP9'><ins id='lUOP9'></ins><ul id='lUOP9'></ul><sub id='lUOP9'></sub></form><legend id='lUOP9'></legend><bdo id='lUOP9'><pre id='lUOP9'><center id='lUOP9'></center></pre></bdo></b><th id='lUOP9'></th></span></q></dt></tr></i><div id='lUOP9'><tfoot id='lUOP9'></tfoot><dl id='lUOP9'><fieldset id='lUOP9'></fieldset></dl></div>
                  <bdo id='lUOP9'></bdo><ul id='lUOP9'></ul>

                  <tfoot id='lUOP9'></tfoot>

                  <legend id='lUOP9'><style id='lUOP9'><dir id='lUOP9'><q id='lUOP9'></q></dir></style></legend>