如何在垂直制表符中水平放置文本? [英] How to position text horizontally in vertical tabs?
问题描述
我有垂直标签,但想旋转"标签标签,以便水平阅读.该怎么办?
I have vertical tabs but want to 'rotate' the tab labels so that these read horizontally. How could this be done?
kivy文件包含:
TabbedPanel:
id: tab_panel
tab_pos: 'left_top'
do_default_tab: False
TabbedPanelItem:
text: '1'
TabbedPanelItem:
text: '2'
TabbedPanelItem:
text: '3'
推荐答案
编辑:实际上, IS 是可能的!
Actually, it IS possible!
TabbedPanelItem:
text: '2'
canvas.before:
PushMatrix
Rotate:
angle: -90
axis: 0,0,1
origin: self.center
canvas.after:
PopMatrix
使用当前的api是不可能的.如果您设法做到这一点,将非常丑陋,因为它会拉伸制表符并将其设置为 square 或什至另一个90°旋转的矩形,它将尽可能地拧您的Layout
-原始选项卡看起来像随意的Button
和整个TabbedPanel
,作为初学者尝试制作html页面的尝试想要限制自己使用当前字体大小的3-4个字符.只是说.
With current api impossible. And it'll be really ugly if you manage to do it, because it'll stretch the tab-header and make it a square or even another, 90° rotated rectangle, which will screw your Layout
as much as possible - the original tab will look like a casual Button
and whole TabbedPanel
as a beginner's try to make html page if you don't want to limit yourself to 3-4 characters with current font size. Just saying.
您可能会尝试编辑源代码,而直接执行源代码的方法之一就是制作一个自定义的ToggleButton
,TabbedPanelHeader
会继承该自定义ToggleButton
并使用Push/PopMatrix()
对其进行旋转.
You may try to edit the source and one of the ways how to do it directly is making a custom ToggleButton
from which TabbedPanelHeader
inherits and rotate it with Push/PopMatrix()
.
另一种(也是更合理的)方法是使选项卡看起来像这样:
The other (and more reasonable) way would be to make tabs look like this:
t|
a| content
b|
_|
即文字向上->向下,尽管除了旋转整个内容并使用这样的字符外,我不知道该怎么做:t\na\nb
i.e. text going up -> down, though I don't know how to do it except rotating the whole thing and work with characters like this: t\na\nb
这篇关于如何在垂直制表符中水平放置文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!