Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:not': 0.03; 'root': 0.05; 'subject:Python': 0.06; 'linux,': 0.07; 'purpose.': 0.07; 'tkinter': 0.07; 'enabled.': 0.09; 'exit': 0.09; 'screen.': 0.09; 'windows,': 0.09; 'wrong,': 0.09; 'runs': 0.10; 'cc:addr :python-list': 0.11; 'def': 0.12; 'gui': 0.12; 'cc:name:python list': 0.16; 'defined.': 0.16; 'nameerror:': 0.16; 'namespace,': 0.16; 'run:': 0.16; 'subject:3.3': 0.16; 'subject:Hiding': 0.16; 'subject:Tkinter': 0.16; 'tk()': 0.16; 'top-level': 0.16; '\xa0this': 0.16; 'wrote:': 0.18; 'variable': 0.18; 'wed,': 0.18; 'app': 0.19; 'skip:f 30': 0.19; 'appears': 0.22; 'import': 0.22; 'cc:addr:python.org': 0.22; 'skip:l 30': 0.24; 'helpful': 0.24; 'question': 0.24; 'cc:2**0': 0.24; "i've": 0.25; 'player': 0.26; 'this:': 0.26; 'defined': 0.27; 'skip:" 20': 0.27; 'header:In- Reply-To:1': 0.27; 'function': 0.29; 'testing': 0.29; 'fixed': 0.29; 'statement': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'code': 0.31; 'comments': 0.31; "skip:' 10": 0.31; '(although': 0.31; '3.2': 0.31; 'file': 0.32; 'skip:m 30': 0.32; 'another': 0.32; 'open': 0.33; 'running': 0.33; '(most': 0.33; 'skip:& 30': 0.33; 'screen': 0.34; 'problem': 0.35; 'something': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'doing': 0.36; 'shows': 0.36; 'hi,': 0.36; 'application': 0.37; 'two': 0.37; 'starting': 0.37; 'button': 0.38; 'skip:& 10': 0.38; '(i.e.,': 0.38; 'jason': 0.38; 'skip:m 40': 0.38; 'window': 0.38; 'pm,': 0.38; 'recent': 0.39; 'skip:& 20': 0.39; 'does': 0.39; 'bad': 0.39; 'above,': 0.60; 'hope': 0.61; 'full': 0.61; 'course': 0.61; 'simple': 0.61; 'name': 0.63; 'kind': 0.63; 'sample': 0.67; 'attention.': 0.68; 'to:addr:aol.com': 0.68; 'fact,': 0.69; 'goal': 0.75; 'click': 0.77; '11:45': 0.84; 'taskbar': 0.84; 'kid': 0.91; 'opens': 0.91; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=HF6o1NPfd8FsfeLHQEcaVMyPYlFp8LOMObtSI1OcRT0=; b=lhqfjdiVapwmR1wP+iVOTMf1x4dEC7oAJhVZAvgCUSW9tAi5F+/LwhUdExwBQ29oDf IGa2XEZ2kluFJYA+VQLlogwSlB7iEgwmmKfoQlIKgn11yM4swfb+B8kZb67dHJUcfIG6 B+frq4mVprNlkY50H1cfCHFgb5w1+RmNpnooTWZ91eA0H2fwapxhgKlREYwlYHbkMsUI 5pmUr9SkESSKXaLOCi6La39Ym8eZ5KIj87hHs7orvAxMtv15DocfvAYn5Iwms/WrVkIP r15CYG26IEcA5bhxOgRdKLBDNXd/g/O9XnJrZqBZ3QRGgtKKPfFl5vCXH/nXY+OJJBDs apJQ== MIME-Version: 1.0 X-Received: by 10.42.50.202 with SMTP id b10mr3414014icg.7.1365083376745; Thu, 04 Apr 2013 06:49:36 -0700 (PDT) In-Reply-To: References: Date: Thu, 4 Apr 2013 09:49:36 -0400 Subject: Re: Python 3.3 Tkinter Fullscreen - Taskbar not Hiding From: Jason Swails To: teslafrequency@aol.com Content-Type: multipart/alternative; boundary=90e6ba61453ac28d5304d9893dd2 Cc: python list X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 237 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1365083379 news.xs4all.nl 6850 [2001:888:2000:d::a6]:53091 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:42753 --90e6ba61453ac28d5304d9893dd2 Content-Type: text/plain; charset=ISO-8859-1 I've added some comments about the code in question as well... On Wed, Apr 3, 2013 at 11:45 PM, wrote: > Hi, I am working with Tkinter, and I have set up some simple code to run: > > import tkinter > import re > from tkinter import * > If you import everything from tkinter into your top-level namespace, then the "import tkinter" at the top serves no purpose. > global master > This 'global master' statement does nothing (and is actually misleading IMO). > master = Tk() > > # Start game Launcher > def FormGUI(): > master.title("GAME TITLE") > SW = master.winfo_screenwidth() / 3.2 > SH = master.winfo_screenheight() / 3.2 > master.geometry("500x300+%d+%d" % (SW, SH)) > Label(master,text="game:\nGAME TITLE").pack() > Button(master, text="Start game", command=DestroyStart, > takefocus=1).pack() > master.wm_state(zoom) > What is "zoom"? This variable is not defined. In fact, I get a NameError when I try running your code because of this: Traceback (most recent call last): File "test_tk.py", line 38, in FormGUI() File "test_tk.py", line 18, in FormGUI master.wm_state(zoom) NameError: global name 'zoom' is not defined If I change zoom to "normal" (with quotes), it appears to work (although I'm testing on Linux, not Windows). > # Destroy the GUI launcher window upon player starting the game. > def DestroyStart(): > global master > master.destroy() > master = Tk() > ReformGui() > > # Form the game's GUI window in full screen. > def ReformGui(): > master.title("GAME TITLE") > SW = master.winfo_screenwidth() > SH = master.winfo_screenheight() > master.geometry("%dx%d+0+0" % (SW,SH)) > master.attributes("-fullscreen", 1) > master.configure(bg="black") > Label(master, text="\"GAME TESTING TEXT\"", > background="black", foreground="white").pack() > FormGUI() > > master.mainloop() > > # END OF CODE > > Everything in this code runs appropriately. The main goal of this code is > to open up two windows, one with fixed dimensions, the other with > full-screen enabled. > > My problem is that with the code above, the full-screen window opens up > properly, however my taskbar shows over the full-screen. Until I click on > the full-screen window, the taskbar will not be hidden. > > Am I doing something wrong, or is there a better way to create a > full-screen window in Tkinter with the taskbar hidden? > This sounds to me that your full screen window does not have the focus (i.e., it is not the `active' window). Try adding a "master.focus_force()" call in the ReformGui function to force it to take focus. Note that focus_force() is often considered 'impolite'---it's akin to that kid that always needs to be the center of attention. Of course it's not as bad as master.grab_set_global :) If your application already has 'focus', then you can use focus_set instead of focus_force. The problem may be that you are destroying the original master window and re-creating another (I typically avoid destroying the root window mid-application). Also as a note, it would be helpful to have some kind of button or something to exit the app or exit fullscreen. I had to Alt-F4 in order to quit your sample program ;). Hope this helps, Jason --90e6ba61453ac28d5304d9893dd2 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
I&= #39;ve added some comments about the code in question as well...

On Wed, Apr 3, 2013 at= 11:45 PM, <teslafrequency@aol.com> wrote:
Hi, I am working with Tkinter, and I have set up some simp= le code to run:

import tkinter
import re
from tkinter import *

If you import everything from tkinter int= o your top-level namespace, then the "import tkinter" at the top = serves no purpose.
global master

This 'global master' statement does nothi= ng (and is actually misleading IMO).
master =3D Tk()

# Start game Launcher
def FormGUI():
=A0 =A0 master.title("GAME TITLE")
=A0 =A0 SW =3D master.winfo_screenwidth() / 3.2
=A0 =A0 SH =3D master.winfo_screenheight() / 3.2
=A0 =A0 master.geometry("500x300+%d+%d" % (SW, SH))
=A0 =A0 Label(master,text=3D"game:\nGAME TITLE").pack()
=A0 =A0 Button(master, text=3D"Start game", command=3DDestroyStar= t, takefocus=3D1).pack()
=A0 =A0 master.wm_state(zoom)

What is "zoom"? =A0This= variable is not defined. =A0In fact, I get a NameError when I try running = your code because of this:

Traceback (most recent call las= t):
=A0 Fi= le "test_tk.py", line 38, in <module>
=A0 =A0 FormGUI()
=A0 File "= ;test_tk.py", line 18, in FormGUI
=A0 =A0 master.wm_state(zoom)
NameError: global name= 'zoom' is not defined

If I change zoom to "nor= mal" (with quotes), it appears to work (although I'm testing on Li= nux, not Windows).


# Destroy the GUI launcher window upon player starting the game.
def DestroyStart():
=A0 =A0 global master
=A0 =A0 master.destroy()
=A0 =A0 master =3D Tk()
=A0 =A0 ReformGui()

# Form the game's GUI window in full screen.
def ReformGui():
=A0 =A0 master.title("GAME TITLE")
=A0 =A0 SW =3D master.winfo_screenwidth()
=A0 =A0 SH =3D master.winfo_screenheight()
=A0 =A0 master.geometry("%dx%d+0+0" % (SW,SH))
=A0 =A0 master.attributes("-fullscreen", 1)
=A0 =A0 master.configure(bg=3D"black")
=A0 =A0 Label(master, text=3D"\"GAME TESTING TEXT\"", =A0 =A0 background=3D"black", foreground=3D"white").pac= k()

FormGUI()

master.mainloop()

# END OF CODE

Everything in this code runs appropriately. The main goal of this code is t= o open up two windows, one with fixed dimensions, the other with full-scree= n enabled.

My problem is that with the code above, the full-screen window opens up pro= perly, however my taskbar shows over the full-screen. Until I click on the = full-screen window, the taskbar will not be hidden.

Am I doing something wrong, or is there a better way to create a full-scree= n window in Tkinter with the taskbar hidden?

This sounds to me = that your full screen window does not have the focus (i.e., it is not the `= active' window). =A0Try adding a "master.focus_force()" call = in the ReformGui function to force it to take focus. =A0Note that focus_for= ce() is often considered 'impolite'---it's akin to that kid tha= t always needs to be the center of attention. Of course it's not as bad= as master.grab_set_global :)

If your application already = has 'focus', then you can use focus_set instead of focus_force. =A0= The problem may be that you are destroying the original master window and r= e-creating another (I typically avoid destroying the root window mid-applic= ation).

Also as a note, it would be = helpful to have some kind of button or something to exit the app or exit fu= llscreen. =A0I had to Alt-F4 in order to quit your sample program ;).

Hope this helps,<= /div>
Jason
--90e6ba61453ac28d5304d9893dd2--