• <bdo id='ToYke'></bdo><ul id='ToYke'></ul>

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

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

        如何在kivy中更改弹出颜色

        时间:2023-10-09
        <legend id='hX42G'><style id='hX42G'><dir id='hX42G'><q id='hX42G'></q></dir></style></legend>
          <tbody id='hX42G'></tbody>
        • <tfoot id='hX42G'></tfoot>
        • <i id='hX42G'><tr id='hX42G'><dt id='hX42G'><q id='hX42G'><span id='hX42G'><b id='hX42G'><form id='hX42G'><ins id='hX42G'></ins><ul id='hX42G'></ul><sub id='hX42G'></sub></form><legend id='hX42G'></legend><bdo id='hX42G'><pre id='hX42G'><center id='hX42G'></center></pre></bdo></b><th id='hX42G'></th></span></q></dt></tr></i><div id='hX42G'><tfoot id='hX42G'></tfoot><dl id='hX42G'><fieldset id='hX42G'></fieldset></dl></div>

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

                • <bdo id='hX42G'></bdo><ul id='hX42G'></ul>
                  本文介绍了如何在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中更改弹出颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

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

                  相关文章

                  最新文章

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

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

                        <bdo id='lJAtH'></bdo><ul id='lJAtH'></ul>
                      <tfoot id='lJAtH'></tfoot>