如何旋转整个kivy application main window?

How to rotate the entire kivy application main window?

我构建了一个 kivy 应用程序,专为在纵向触摸屏设备中使用而设计。但是,设备本身(定制的)仅设置为 运行 个横向应用程序。

我需要将整个应用程序旋转 window 90° 但是当我使用

Window.rotation = 90

我所有的位置提示都被弄乱了,因为实际的宽度和高度被交换了

当我使用

canvas.before:
    PushMatrix
    Rotate:
        angle: 90
        origin: self.center
canvas.after:
    PopMatrix

纵横比似乎是正确的,但我最终 on_press 输入旋转了 90° 并且没有与显示的按钮对齐(即原始正确位置的不可见按钮和可见按钮由于旋转 window.

,现在位于新位置

是否有一个我没有找到的模块可以旋转整个应用程序?

您需要更改 raspberry pi 上的 config.ini 文件。 它会在 .kivy 文件夹中。 在文件中,您需要找到图形部分,然后在图形部分下找到旋转并将其更改为 90、180 或 270

[kivy]
keyboard_repeat_delay = 300
keyboard_repeat_rate = 30
log_dir = logs
log_enable = 1
log_level = info
log_name = kivy_%y-%m-%d_%_.txt
window_icon = 
keyboard_mode = 
keyboard_layout = qwerty
desktop = 1
exit_on_escape = 1
pause_on_minimize = 0
kivy_clock = default
default_font = ['Roboto', 'data/fonts/Roboto-Regular.ttf', 'data/fonts/Roboto-Italic.ttf', 'data/fonts/Roboto-Bold.ttf', 'data/fonts/Roboto-BoldItalic.ttf']
log_maxfiles = 100
window_shape = data/images/defaultshape.png
config_version = 21

[graphics]
display = -1
fullscreen = 0
height = 600
left = 0
maxfps = 60
multisamples = 2
position = auto
**rotation = 0**
show_cursor = 1
top = 0
width = 800
resizable = 1
borderless = 0
window_state = visible
minimum_width = 0
minimum_height = 0
min_state_time = .035
allow_screensaver = 1
shaped = 0
vsync = 
verify_gl_main_thread = 1
custom_titlebar = 0
custom_titlebar_border = 5

[input]
mouse = mouse
wm_touch = wm_touch
wm_pen = wm_pen

[postproc]
double_tap_distance = 20
double_tap_time = 250
ignore = []
jitter_distance = 0
jitter_ignore_devices = mouse,mactouch,
retain_distance = 50
retain_time = 0
triple_tap_distance = 20
triple_tap_time = 375

[widgets]
scroll_timeout = 250
scroll_distance = 20
scroll_friction = 1.
scroll_stoptime = 300
scroll_moves = 5

[modules]

[network]
useragent = curl

但我 运行 遇到触摸不正确翻转的问题,需要在 pi 中进行更改。