Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TabbedPanel button text is rotated when 'tab_pos: "left_top"' is used #8728

Open
GregDuckworthRenishaw opened this issue May 15, 2024 · 1 comment

Comments

@GregDuckworthRenishaw
Copy link

GregDuckworthRenishaw commented May 15, 2024

Software Versions

  • Python: 3.12.2
  • OS: Windows 10 up to date
  • Kivy: 2.3.0
  • Kivy installation method: Pycharm via pip

Describe the bug

When a Tabbed Panel is defined in the kv file, with the option 'tab_pos: "left_top"', the resulting buttons are rotated 90 degrees such that the text runs from bottom to top on the screen. The rotation of the buttons is not readily changeable.

The issue tracker is a tool to address bugs only (search known bugs: https://git.io/vM1iE).
Please use the #support Discord channel at https://chat.kivy.org/ or Stack Overflow for
support questions, more information at https://git.io/vM1yQ.

Expected behavior
The button text should be able to be horizontal or vertical as needed.

A partial solution involving canvas.before: rotation results in a button that looks incorrect if the button is not square to begin with.

To Reproduce

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

Builder.load_string('''
<WrongTab>:
    do_default_tab: False
    tab_pos: "left_top"
    tab_height: 150
    tab_width: 50
    TabbedPanelItem:
        text: "first heading"
''')


class WrongTab(TabbedPanel):
    pass


class TestApp(App):
    def build(self):
        return WrongTab()


if __name__ == "__main__":
    TestApp().run()

See below for current partial solution:

Code and Logs and screenshots

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

Builder.load_string('''
<WrongTab>:
    do_default_tab: False
    tab_pos: "left_top"
    tab_height: 150
    tab_width: 50
    TabbedPanelItem:
        text: "first heading"
        canvas.before:
            PushMatrix
            Rotate:
                angle: -90
                origin: self.center
        canvas.after:
            PopMatrix
''')


class WrongTab(TabbedPanel):
    pass


class TestApp(App):
    def build(self):
        return WrongTab()


if __name__ == "__main__":
    TestApp().run()

Additional context
The background issue can be more clearly seen if the rotation angle is set to -45

@ElliotGarbus
Copy link
Contributor

If you look at the tabbed_panel_showcase.py example, you can see how custom tabs can be rotated using a scatter.
https://github.com/kivy/kivy/blob/master/examples/widgets/tabbed_panel_showcase.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants