Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #10606 > unrolled thread

Re: Windows: setting title of console window

Started byEthan Furman <ethan@stoneleaf.us>
First post2011-07-30 17:07 -0700
Last post2011-07-30 17:07 -0700
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Windows: setting title of console window Ethan Furman <ethan@stoneleaf.us> - 2011-07-30 17:07 -0700

#10606 — Re: Windows: setting title of console window

FromEthan Furman <ethan@stoneleaf.us>
Date2011-07-30 17:07 -0700
SubjectRe: Windows: setting title of console window
Message-ID<mailman.1680.1312070931.1164.python-list@python.org>
Thomas Jollans wrote:
> On 30/07/11 20:39, Ethan Furman wrote:
>> How it works: since the sys.argv object does yet exist, I create an
>> object and assign it to sys.argv; then, when Python assigns the actual
>> argv to sys.argv, my object is tossed, and the __del__ method is called;
>> the __del__ method is then able to access the real argv and set the
>> title bar accordingly. I put the sleep in just to avoid any possible
>> race conditions, but I'm not sure it's necessary. If you don't want to
>> see all the command-line args, you can pre-process command any way you
>> like.
> 
> Why though? Can't you just call SetConsoleTitle immediately?

When you say immediately, when exactly do you mean?

I can't call it when sitecustomize first runs because sys.argv does not 
yet exist.  If I call it as soon as __del__ is run (without the sleep) 
then sometimes it works, but at least once it failed.  I haven't done a 
lot of research into it as it hasn't failed with the bit of sleep thrown 
in, and I have bigger fish to fry.  Now where did I put the tartar 
sauce?  ;)

~Ethan~

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web