<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中更改弹出颜色

      How to change popup color in kivy(如何在kivy中更改弹出颜色)
      <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 1.9.0 Windows package KeyError: #39;rthooks#39;(Kivy 1.9.0 Windows 包 KeyError: rthooks)
                Python Kivy: how to call a function on button click?(Python Kivy:如何在按钮单击时调用函数?)
                How to disable a widget in Kivy?(如何禁用 Kivy 中的小部件?)
                Centering an object in Kivy(在 Kivy 中将对象居中)
                How to downgrade to Python 3.4 from 3.5(如何从 Python 3.5 降级到 Python 3.4)
                Change button or label text color in kivy(在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>

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