🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.tcl
Article #155

Re: Tk - centrowanie głównego okna

#155
From: Wojciech Kocjan
Date: Thu, 28 Jul 2005 17:04
27 lines
1721 bytes
Maciej Sobczak napisał(a):
> Poddaję się.
> 
> Czy ktoś z grupowiczów zna metodę na to, żeby główne okno programu 
> Tcl/Tk ustawić na środku ekranu?
> 
> Mam drobny programik w Tcl/Tk, który jest uruchamiany przez inną 
> aplikację okienkową. Jedyne okno tego drobnego pomocniczego programu 
> wyświetla się w lewym górnym rogu ekranu - chciałbym, żeby pojawiło się 
> na środku.
> 
> Bardziej ogólnie: chciałbym, żeby pojawiło się w zadanych (X, Y).

pod koniec:

# (bez tej linijki wszystko nie zadziala)
update idletasks

set width [winfo width .]
set height [winfo height .]
set swidth [winfo screenwidth .]
set sheight [winfo screenheight .]

wm geometry . +[expr {($swidth-$width)/2}]+[expr {($sheight+$height)/2}]

-- 
WK
Technical Details
Message-ID: <dcb36g$d2a$1@atlantis.news.tpi.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!newsfeed.tpinternet.pl!nemesis.news.tpi.pl!atlantis.news.tpi.pl!news.tpi.pl!not-for-mail
References: <dca44h$k0d$1@sunnews.cern.ch>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!newsfeed.tpinternet.pl!nemesis.news.tpi.pl!atlantis.news.tpi.pl!news.tpi.pl!not-for-mail
From: Wojciech Kocjan <hceicjow.backward@kocjan.org>
Newsgroups: pl.comp.lang.tcl
Subject: Re: Tk - centrowanie głównego okna
Date: Thu, 28 Jul 2005 19:04:14 +0200
Organization: tp.internet - http://www.tpi.pl/
Lines: 27
Message-ID: <dcb36g$d2a$1@atlantis.news.tpi.pl>
References: <dca44h$k0d$1@sunnews.cern.ch>
NNTP-Posting-Host: bou61.neoplus.adsl.tpnet.pl
Mime-Version: 1.0
X-Trace: atlantis.news.tpi.pl 1122570256 13386 83.29.36.61 (28 Jul 2005 17:04:16 GMT)
X-Complaints-To: usenet@tpi.pl
NNTP-Posting-Date: Thu, 28 Jul 2005 17:04:16 +0000 (UTC)
User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206)
X-Accept-Language: pl, en-us, en
In-Reply-To: <dca44h$k0d$1@sunnews.cern.ch>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit