Kivy-TabbedPanel标头稍有偏移 [英] Kivy - TabbedPanel headers slight offset

查看:44
本文介绍了Kivy-TabbedPanel标头稍有偏移的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是TabbedPanel(默认值为tab_pos: "top_left"),但标题(如在文档中可以看到的)略微不在左侧.就像有一个小的1px的左填充被应用了.我不知道如何配置它.有什么见解吗?谢谢!

I'm using the TabbedPanel (with the default tab_pos: "top_left") but the headers (as one can see in the docs) are slighty not on the left. It's like there is a small padding-left of 1px which is applied. I can't figure out how to configure that. Any insights? Thanks!

推荐答案

hacky的非精美解决方案:

A hacky, non-pretty solution:

from kivy.app import App
from kivy.uix.tabbedpanel import TabbedPanel
from kivy.lang import Builder

Builder.load_string('''
<MyWidget>:
    TabbedPanelItem:
        text: 'tab1'
    TabbedPanelItem:
        text: 'tab2'
''')


class MyWidget(TabbedPanel):
    def __init__(self, **kwargs):
        super(MyWidget, self).__init__(**kwargs)
        self._tab_layout.padding = [0, 0, 0, 0]


class MyApp(App):
    def build(self):
        return MyWidget()


if __name__ == '__main__':
    MyApp().run()

这篇关于Kivy-TabbedPanel标头稍有偏移的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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