🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Tk - centrowanie g³ównego okna

#159
From: Wojciech Kocjan
Date: Tue, 09 Aug 2005 07:14
30 lines
1714 bytes
Maciej Sobczak napisał(a):
>> Podejrzewam, ze da sie ten problem ominac uzywajac [wm
>> withdraw]
> Podejrzewam, że nie w tym przypadku - główna aplikacja jest zablokowana 
> i się i tak nie odświeży, niezależnie od tricków po stronie Tcl.

A może:

proc centerWindow {p} {
     set xx [expr {([winfo screenwidth $p] - [winfo width $p]) / 2}]
     set xy [expr {([winfo screenheight $p] - [winfo height $p]) / 2}]

     wm geometry $p +${xx}+${xy}
}

toplevel .xx
frame .xx.yy
text .xx.yy.zz -width 100 -height 1
pack .xx.yy.zz -fill both -expand 1
pack .xx.yy -fill both -expand 1

wm withdraw .xx
update
centerWindow .xx
wm deiconify .xx

U mnie na Windows działa.

-- 
WK
Technical Details
Message-ID: <dd9l5c$9fh$1@nemesis.news.tpi.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!newsfeed.atman.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> <dccsj1$rij$1@srv.cyf-kr.edu.pl> <dd72ae$2ip$1@sunnews.cern.ch>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!newsfeed.atman.pl!newsfeed.tpinternet.pl!nemesis.news.tpi.pl!atlantis.news.tpi.pl!news.tpi.pl!not-for-mail
From: Wojciech Kocjan <mojeimie@kocjan.org>
Newsgroups: pl.comp.lang.tcl
Subject: Re: Tk - centrowanie g³ównego okna
Date: Tue, 09 Aug 2005 09:14:41 +0200
Organization: tp.internet - http://www.tpi.pl/
Lines: 30
Message-ID: <dd9l5c$9fh$1@nemesis.news.tpi.pl>
References: <dca44h$k0d$1@sunnews.cern.ch> <dccsj1$rij$1@srv.cyf-kr.edu.pl> <dd72ae$2ip$1@sunnews.cern.ch>
NNTP-Posting-Host: dq2.dataquest.pl
Mime-Version: 1.0
X-Trace: nemesis.news.tpi.pl 1123571692 9713 195.116.54.236 (9 Aug 2005 07:14:52 GMT)
X-Complaints-To: usenet@tpi.pl
NNTP-Posting-Date: Tue, 9 Aug 2005 07:14:52 +0000 (UTC)
User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)
X-Accept-Language: pl, en-us, en
In-Reply-To: <dd72ae$2ip$1@sunnews.cern.ch>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit