[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] How to control the physical size of displayed objects?
- To: pygame-users@xxxxxxxx
- Subject: Re: [pygame] How to control the physical size of displayed objects?
- From: James Paige <Bob@xxxxxxxxxxxxxxxxxxx>
- Date: Wed, 27 Feb 2013 07:51:57 -0800
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Wed, 27 Feb 2013 10:52:05 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:date:from:to:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to; bh=lv6KygKttvGJR91m6SCatJP+LTekWAL38NYdINdN2YI=; b=o3WXzkkdH40TIaXStA+HL9oWubxV6GI7Nb7vhncdgaejPJGMpocP1uB6QvAKeQbM0i e3acvzCPLzj8Lv4orGqlPaxMDhMymkE1XQcB4jejJBr+sI6WFlG78pu7buFcAsNCB6CF F9O5OxQxCpW56DlDlUUTPzJDqyueckAeMTCYErMOvi7PotSqZepB4AYUYhgzgRpSp2Jv eXlm8dDgxSNiDupNswn4Do1ToOu4Q4Y8DQIchJQTVcCjHsKFyseQT5yIe0GZIQY2TXyo BwUUoW5hyrOUe61dkeXUqE14xLVKhZvrfGyUV5jNdGaWRQuKtlYDoEeKlKCcWCgHBujb YXqQ==
- In-reply-to: <512E2158.6090604@xxxxxxxx>
- References: <512E2158.6090604@xxxxxxxx>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
On Wed, Feb 27, 2013 at 04:08:08PM +0100, Mathieu Dubois wrote:
> Hello,
>
> I'm working on a program (written by someone else) to use PyGame to
> display some images for use in a psychological experiment. I am new to
> PyGame.
>
> For the experiment we need to display circles of a given physical size
> (let's that the diameter must be 30mm). Currently the program seems to
> do the conversion with a hardcoded value.
>
> I wanted to know if it possible to compute this value automatically.
>
> If I understand correctly, I need to know the physical size of the
> screen and the resolution. Knowing the resolution is simple with PyGame
> but how can I access the screen size?
>
> The program should be multi-platform.
>
> Any advice?
>
> Thanks in advance,
> Mathieu
Sadly, I believe this is nearly impossible to do in a reliable an
automated way. This is not just for pygame, but any program.
If you need to support monitors that connect with a VGA cable, then I
believe it is completely impossible. (if someone knows otherwise, please
correct me!)
If the monitor is identified by the operating system, you can get the
DPI, but this information can't be trusted. DPI settings are seldom
guaranteed to be accurate. They might be correct, they might be
incorrect, they might be intentionally misconfigured to manipulate font
sizes, or other such ridiculous things.
If you want something simple and cross-platform, I would suggest
displaying a calibration screen where you can hold a physical ruler up
to the screen while spinning the mouse wheel until the on-screen ruler
matches the physical ruler, and then save that constant in a config
file, or something like that.
(Again, if anybody knows any tricks to do this automatically, please
speak up and correct me, but I will be shocked if there is a
single cross-platform way)
---
James