更改背景颜色的默认选项卡 [英] Change background color default tab on kivy

查看:118
本文介绍了更改背景颜色的默认选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何更改kivy上默认选项卡的背景颜色? 我可以更改内容和其他选项卡的背景,但是默认选项卡保持不变,这是我的代码:

How can I change the background color of the default tab on kivy? I'm able to change the background of the content and other tabs, but the default tab remains unchanged, this is my code:

class DAP(App):

    title = u'Aplicativo do DAP'
    # Funções para evitar que o aplicativo desligue ao mudar o foco da tela no celular
    def on_pause(self):  return True
    def on_resume(self): pass



    def build(self):

        self.cor_fonte = (0, 0, 1, 1)
        self.cor_fundo = (1, 1, 1, 0)

         #Abas
        self.painel                  = TabbedPanel(background_color = self.cor_fundo, default_tab_text=u'Principal')
        self.aba_resumo              = TabbedPanelHeader(text=u'Resumo PC',    background_color = self.cor_fundo, color = self.cor_fonte)
        self.aba_registros           = TabbedPanelHeader(text=u'Registros PC', background_color = self.cor_fundo, color = self.cor_fonte)
        self.painel.add_widget(self.aba_resumo)
        self.painel.add_widget(self.aba_registros) 
        self.icon  = u'logo_dap.png'



        # Definições iniciais
        tamx = Window.system_size[0] ; tamy = Window.system_size[1]         
        return self.painel


if __name__ in ('__main__','__android__'):

    DAP().run()

有什么主意吗?

推荐答案

默认选项卡的类型为TabbedPanelHeader,因此您可以使用kivy语言规则对其进行样式设置.

The default tab is of type TabbedPanelHeader, so you can use kivy language rules to style it.

请注意,默认情况下,default_tab_cls的类型为TabbedPanelHeader,因此与其他标签具有相同的属性.

It’s important to note that by default, default_tab_cls is of type TabbedPanelHeader and thus has the same properties as other tabs.

通过将do_default_tab设置为False,您也可以简单地没有默认选项卡.

You can also simply not have a default tab by setting do_default_tab to False.

从1.5.0版本开始,现在可以通过将do_default_tab设置为False来禁用default_tab的创建.

Since 1.5.0, it is now possible to disable the creation of the default_tab by setting do_default_tab to False.

有关更多信息,请阅读文档.

For more information read the documentation.

这篇关于更改背景颜色的默认选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆