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

increase default text size for android displays #10

Open
wants to merge 1 commit into
base: developing
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions expyriment_app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ def main():
if name not in pygame.sysfont.Sysfonts:
pygame.sysfont.Sysalias[name] = found

# assuming expyriment defaults are intended for 160 DPI screens
source_dpi=160
target_dpi=android.get_dpi()
scale=int(target_dpi/source_dpi)
expyriment.design.defaults.experiment_text_size=expyriment.design.defaults.experiment_text_size * scale
# menu needs to be bigger as it needs to be pressed
text_menu_extra=2.5
expyriment.io.defaults.textmenu_text_size=int(expyriment.io.defaults.textmenu_text_size * scale * text_menu_extra)

expyriment.control.defaults.event_logging = 0
exp = expyriment.control.initialize()
mouse = expyriment.io.Mouse(show_cursor=False)
Expand All @@ -79,8 +88,8 @@ def main():
else:
items = projects.keys()
items.sort()
menu = expyriment.io.TextMenu("Run experiment:", items, 320,
scroll_menu=5, mouse=mouse)
menu = expyriment.io.TextMenu("Run experiment:", items, int(320 * scale * text_menu_extra),
scroll_menu=7, mouse=exp.mouse)
py_file = projects[menu.get()]
expyriment.control.defaults.event_logging = 1
expyriment.control.defaults.initialize_delay = 0
Expand Down