2
我的Kivy應用程序在Mac下與在Windows或Linux下有不同的外觀。這背後的原因是什麼?屏幕分辨率?不同操作系統下的安裝過程? ...?Kivy應用程序在Mac上看起來不同
這裏是第一頁的代碼:
#:kivy 1.0.9
<MenuButton>:
font_size: 20
size_hint: None, None
height: 75
width: 300
pos_hint: {'center_x': .5, 'center_y': .5}
MyScreenManager:
HomePage:
#### Home Page ##############################################
<HomePage>:
name: 'Home'
BoxLayout:
orientation: 'vertical'
spacing: 50
padding: 20
BoxLayout:
orientation: 'vertical'
size_hint: 1, 0.23
Label:
text: 'V2G-Sim'
font_size: 50
Label:
text: 'Vehicle to Grid Simulator'
font_size: 30
BoxLayout:
orientation: 'vertical'
size_hint: 1, 0.64
spacing: 20
RelativeLayout:
MenuButton:
text: 'Create vehicles'
on_release:
app.root.transition.direction = 'left'
app.root.current = 'Itinerary'
RelativeLayout:
MenuButton:
text: 'Grid initialization'
on_release:
app.root.transition.direction = 'left'
app.root.current = 'Grid'
RelativeLayout:
MenuButton:
text: 'Simulate vehicles'
on_release:
app.root.transition.direction = 'left'
app.root.current = 'SimulationType'
RelativeLayout:
MenuButton:
text: 'Visualizations'
on_press:
root.raise_popup()
on_release:
root.visualization()
BoxLayout:
orientation: 'horizontal'
size_hint: 1, 0.13
spacing: 30
Button:
text: 'Project status'
font_size: 20
size_hint: 0.7, 1
on_release:
app.root.transition.direction = 'left'
app.root.current = 'ProjectStatus'
Button:
text: 'Exit'
font_size: 20
size_hint: 0.7, 1
on_release:
root.exit_app()
是的,我昨天自己想出了這個。我很驚訝默認單位是像素。此外,我使用** sp **而不是** dp **來確保用戶的設置將被考慮在內。不過謝謝。 –