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


Groups > comp.lang.python > #35549

Re: running gui py script

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <d@davea.name>
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; 'method,': 0.07; 'tkinter': 0.07; 'python': 0.09; 'broken.': 0.09; 'buffer.': 0.09; 'executes': 0.09; 'interpreter,': 0.09; 'nameerror:': 0.09; 'okay': 0.09; 'subject:script': 0.09; 'dec': 0.15; '0.9.5': 0.16; 'definition.': 0.16; 'expected,': 0.16; 'indent': 0.16; 'opens,': 0.16; 'subject:gui': 0.16; 'traceback.': 0.16; 'valid.': 0.16; 'wrote:': 0.17; 'shell': 0.18; 'code,': 0.18; '(or': 0.18; 'app': 0.19; 'versions': 0.20; 'file.': 0.20; 'trying': 0.21; 'either.': 0.22; 'os,': 0.22; 'defined': 0.22; "i'd": 0.22; "i've": 0.23; 'idea': 0.24; 'command': 0.24; 'least': 0.25; 'header:In-Reply- To:1': 0.25; 'header:User-Agent:1': 0.26; 'skip:" 20': 0.26; '(most': 0.27; 'guess': 0.27; 'in.': 0.27; "doesn't": 0.28; 'environment': 0.29; 'invoke': 0.29; 'definition': 0.29; 'class': 0.29; "i'm": 0.29; 'file': 0.32; 'getting': 0.33; 'instead,': 0.33; 'traceback': 0.33; 'to:addr:python-list': 0.33; 'clear': 0.35; 'skip:. 20': 0.35; 'pm,': 0.35; 'but': 0.36; "didn't": 0.36; 'editor': 0.37; 'why': 0.37; 'subject:: ': 0.38; 'mean': 0.38; '2010,': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'think': 0.40; 'your': 0.60; 'skip:u 10': 0.60; 'first': 0.61; 'back': 0.62; 'helps': 0.63; 'show': 0.63; 'header:Reply-To:1': 0.68; 'received:74.208': 0.71; 'reply- to:no real name:2**0': 0.72; 'received:74.208.4.194': 0.84; 'subject:running': 0.84
Date Wed, 26 Dec 2012 18:22:21 -0500
From Dave Angel <d@davea.name>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121011 Thunderbird/16.0.1
MIME-Version 1.0
To python-list@python.org
Subject Re: running gui py script
References <50DB58FF.2050704@gmail.com>
In-Reply-To <50DB58FF.2050704@gmail.com>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
X-Provags-ID V02:K0:bJRSF3dDuZ2Av9xghQxVN0dLsf8Xp54iVjecdaVHdmw WyCXPYBkkyXG8tplsVpmNwTJ3ZGmwUBrkBi4WpFYnuB46+dcPA 3pRf33iMMKEhaOUkxLsD2DbszEjskqzR9+/GyS5Au+p+wyfo5S LHhZM1EE8Dqb5+yK173kGNMlWBrk6feSa/eM43hmB0JSAsPDQE KB3bvTdXtsV9oE5xqT6ya3t5rTM9M8nH/oD/JKSS0IPcbVxyZD Jd/RElcIHSx/GDhyd667Rtgh+j2YENimvhvuWLgUWk6st5dCzj r+OvdwoavrirAvxjKZ5xKjw/dt7/Hkv0oj9inTPfArkkcfrngs w+0Q6ghHJT0mDmTKwR4U=
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
Reply-To d@davea.name
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.1302.1356564168.29569.python-list@python.org> (permalink)
Lines 54
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1356564168 news.xs4all.nl 6851 [2001:888:2000:d::a6]:36738
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:35549

Show key headers only | View raw


On 12/26/2012 03:07 PM, Verde Denim wrote:
> I'm learning py in this environment -
> PyCrust 0.9.5 - The Flakiest Python Shell
> Python 2.6.6 (r266:84292, Dec 26 2010, 22:31:48)
> [GCC 4.4.5] on linux2
>
> When I type a tkinter program in pycrust (or pyshell), it executes as
> expected, but when I call it from a command line, it doesn't. What I'm
> getting back is this -
>
> python my_first_gui_in_py.py
> Traceback (most recent call last):
>   File "my_first_gui_in_py.py", line 2, in <module>
>     class myapp_tk(Tkinter.Tk):
>   File "my_first_gui_in_py.py", line 14, in myapp_tk
>     app = myapp_tk(None)
> NameError: name 'myapp_tk' is not defined
>
> Trying to call the file in pycrust doesn't seem to work for me either.
> If I invoke pycrust either as
> $ pycrust ./my_first_gui_in_py.py or
> $ pycrust < ./my_first_gui_in_py.py
>
> the editor opens, but with an empty buffer.
>
> What is it that I'm not understanding?
Mainly that it helps to actually show your code, or at least as much of
it as you think we might be interested in.
Good job showing us the versions & os, and the full traceback.

No idea why it works in pycrust;  I've never used it, or pyshell.  It's
not clear what you mean by "typing in the shell".  if you mean you're
entering it in the interpreter, then I'd guess you didn't indent it the
same way as in the file.

But if it doesn't work at the command line, it's broken.  And my guess
is that you're trying to use the class inside its own definition. 
That's okay inside a method, but not inside the class initialization.  
For example, if you have

class myapp_tk(Tkinter.Tk):
      app = myapp_tk(None)

it's not valid.  Instead, do the following after the class definition is
complete:

myapp.app = myapp_tk(None)

BTW, it's customary to capitalize the first letter of a class name.

-- 

DaveA

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


Thread

Re: running gui py script Dave Angel <d@davea.name> - 2012-12-26 18:22 -0500

csiph-web