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


Groups > comp.lang.python > #42753

Re: Python 3.3 Tkinter Fullscreen - Taskbar not Hiding

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 <jason.swails@gmail.com>
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 <d6635af4-7a4a-4aeb-8eaf-4b13dee7c003@googlegroups.com>
References <d6635af4-7a4a-4aeb-8eaf-4b13dee7c003@googlegroups.com>
Date Thu, 4 Apr 2013 09:49:36 -0400
Subject Re: Python 3.3 Tkinter Fullscreen - Taskbar not Hiding
From Jason Swails <jason.swails@gmail.com>
To teslafrequency@aol.com
Content-Type multipart/alternative; boundary=90e6ba61453ac28d5304d9893dd2
Cc python list <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.101.1365083379.3114.python-list@python.org> (permalink)
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

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

I'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 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 <module>
    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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Python 3.3 Tkinter Fullscreen - Taskbar not Hiding teslafrequency@aol.com - 2013-04-03 20:45 -0700
  Re: Python 3.3 Tkinter Fullscreen - Taskbar not Hiding Jason Swails <jason.swails@gmail.com> - 2013-04-04 09:49 -0400
    Re: Python 3.3 Tkinter Fullscreen - Taskbar not Hiding Rotwang <sg552@hotmail.co.uk> - 2013-04-04 18:30 +0100
      Re: Python 3.3 Tkinter Fullscreen - Taskbar not Hiding Jason Swails <jason.swails@gmail.com> - 2013-04-04 15:00 -0400
        Re: Python 3.3 Tkinter Fullscreen - Taskbar not Hiding Rotwang <sg552@hotmail.co.uk> - 2013-04-04 23:21 +0100
  Re: Python 3.3 Tkinter Fullscreen - Taskbar not Hiding teslafrequency@aol.com - 2013-04-04 10:31 -0700

csiph-web