POV-Ray : Newsgroups : povray.off-topic : A small project : Re: A small project Server Time
11 Oct 2024 01:22:21 EDT (-0400)
  Re: A small project  
From: Darren New
Date: 19 Mar 2008 21:03:45
Message: <47e1c601$1@news.povray.org>
Invisible wrote:
> And how the heck do I figure out *where* the corner of the screen is? 

I would ask for the coords of the window in the system tray and go from 
there? I haven't done it, but it can't be all that hard. I'm almost 
certain you can get the screen size in pixels from Tcl.

Now, that's assuming you only have one screen.

To answer your question precisely, "winfo screenheight" and "winfo 
screenwidth" are what you're looking for, I think. "winfo" and "wm" 
control all that sort of stuff. (WM referring to the window manager, so 
it controls borders and focus and such. The documentation doesn't 
clarify for me how to avoid taking focus when you create a window.)

> (And, for that matter, avoid stealing the input focus when the window 
> opens?)

I think Windows prevents this from happening in the first place in 
general, but that's a good question.

> It's a scripting language. It doesn't really "do" error-handling. If 
> something goes wrong, the script tends to just choke in an unpredictable 
> way.

No. You're thinking of C. Tcl chokes in very predictable ways. Indeed, 
at work, I use a Tcl monitoring process to restart all the craptastic 
C++ stuff that dumps core about once a week.  (Not that C++ is 
necessarily craptastic, but this stuff is.)

Between [catch] and [bgerror], Tcl should never do something 
unpredictable. Maybe you don't know how Tcl behaves, but it really is 
well-defined.

> Many of the Tcl scripts I run seem to leak memory pretty badly. I did 
> have a Tcl script that did something every 5 minutes - but I discovered 
> that the longer it runs, the more RAM it eats. I now rerun the script 
> every 5 minutes using an external tool.

I have Tcl programs that run literally months without being touched. If 
you're leaking memory, it's because you're storing stuff in globals and 
not cleaning up after yourself.

Granted, there is occasionally a leak in Tcl's memory handling described 
in the bug tracker. But it's rare, and they're all high priority to get 
fixed because people build real systems with Tcl.

Tcl doesn't always dispose of the maximum amount of memory it can, but 
if you free something up after allocating it, that memory does get reused.

> There are many, *many* things that work unexpectedly in Tcl. But then, 
> the language isn't really set up for making production-grade 
> applications, it's designed for quickly throwing things together that 
> work on the day you test them.

I disagree. I've written all kinds of server stuff in Tcl that runs for 
months without being touched, that automatically recovers from my 
mistakes, and so on. If you can't get it to work for you, it's because 
you don't know how, methinks.

-- 
   Darren New / San Diego, CA, USA (PST)
     "That's pretty. Where's that?"
          "It's the Age of Channelwood."
     "We should go there on vacation some time."


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.