bgui
bgui copied to clipboard
Normalise Text/aspect ratio problem
Hi,
I cannot seem to get a correct aspect ratio/normalise text concerning my buttons (or anything) and inside the buttons. Two pictures below to show what I mean. In Windowed mode it looks good, but in Fullscreen it looks bad. I have tried putting Normalise_text = True and changing the aspect ratio but it does not seem to work...
Here is a simplified code of my application :
import bgui import bgui.bge_utils import bge
#This is the Main Layout. This never dissapears class MainLayout(bgui.bge_utils.Layout): """A layout showcasing various Bgui features"""
def __init__(self, sys, data):
super().__init__(sys, data)
# Add widgets here
# Use a frame to store all of our widgets
self.frame = bgui.Frame(self, border=0)
self.frame.colors = [(0, 0, 0, 0) for i in range(4)]
# A FrameButton widget
self.btn = bgui.FrameButton(self.frame, text='Import', size=[0.1, 0.05], pos=[0, 0.95],
base_color =(0,255,255,1), options=bgui.BGUI_DEFAULT)
self.btn.on_click = self.button_click
self.btn2 = bgui.FrameButton(self.frame, text='Start Simulation', size=[0.2, 0.05], pos=[0.1, 0.95],
options=bgui.BGUI_DEFAULT)
self.btn2.on_click = self.button_click2
self.btn3 = bgui.FrameButton(self.frame, text='Stop Simulation', size=[0.2, 0.05], pos=[0.3, 0.95],
options=bgui.BGUI_DEFAULT)
self.btn3.on_click = self.button_click3
#Simple TextBlock Widget
self.txt = bgui.TextBlock(self.frame, color =(0,255,255,1), text ='Hello I am testing this',pt_size = 30,pos=[0,-0.95])
#These are the definitions def button_click(self, widget): self.lbl.text = 'This is the Import Button' widget.system.toggle_overlay(testoverlay)
def button_click2(self, widget):
self.lbl.text = "This starts the Simulation"
def button_click3(self, widget):
self.lbl.text = "This Stops the Simulation"
def main(cont): own = cont.owner mouse = bge.logic.mouse
if 'sys' not in own:
# Create our system and show the mouse
own['sys'] = bgui.bge_utils.System('../../themes/default')
own['sys'].load_layout(MainLayout, None)
mouse.visible = True
normalise_text=True
else:
own['sys'].run()
normalise_text=True