Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #44279
| Path | csiph.com!usenet.pasdenom.info!news.etla.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <kwpolska@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.099 |
| X-Spam-Evidence | '*H*': 0.80; '*S*': 0.00; 'tkinter': 0.07; 'width': 0.09; '\xe2\x80\x94': 0.09; 'cc:addr:python-list': 0.11; 'def': 0.12; '24,': 0.16; 'gpg': 0.16; 'stuff.': 0.16; 'subject:gui': 0.16; 'tk.': 0.16; 'wrote:': 0.18; 'wed,': 0.18; '(but': 0.19; 'seems': 0.21; 'command': 0.22; 'import': 0.22; 'cc:addr:python.org': 0.22; 'copied': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'compare': 0.26; 'daniel': 0.26; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'url:mailman': 0.30; 'code': 0.31; 'fixing': 0.31; 'helpful.': 0.31; 'class': 0.32; 'stuff': 0.32; 'text': 0.33; 'url:python': 0.33; 'running': 0.33; 'skip:_ 10': 0.34; "i'd": 0.34; 'equal': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'idle': 0.36; 'right?': 0.36; 'url:listinfo': 0.36; 'url:org': 0.36; 'being': 0.38; 'problems': 0.38; 'url:library': 0.38; 'pm,': 0.38; 'does': 0.39; 'sure': 0.39; 'url:mail': 0.40; 'skip:u 10': 0.60; 'skip:t 30': 0.61; 'today,': 0.61; 'from:charset:utf-8': 0.61; 'forward': 0.65; 'distance': 0.65; 'to:addr:gmail.com': 0.65; 'here': 0.66; 'sample': 0.67; 'home': 0.69; 'day': 0.76; 'missing.': 0.84; 'textbook': 0.84; 'worry,': 0.84; 'don\xe2\x80\x99t': 0.91; 'url:tk': 0.95; 'serious': 0.97; '2013': 0.98 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type:content-transfer-encoding; bh=du3DmC479vyjXmAK9X9bIMsIS6kxH4J+UHYeSBkXdJs=; b=Ct+IdeEXX+QfKrTb4A1WLzwZl5XpIUz/Mr0kXUvanlhsExesYlCXKi+xUYAkTmqn4m rkm8vWh0xQkuHqYTS1AZOXAEz8jLpkgkjb/UJ4eszhDJRZowDz3dexKcbMrDQ1S5OSww 2MZwuqXclK4Ovy6EPkswOBkVU19VSQRFrM8ou+TgdBjp63MrZxrOIjp14QRF6D708tGL YaiKFGPgz3eeXDI9RJmB75gWk8BsjbQhOoWbdkzxN7D1p/eY62V2j8LC5eiub+d/oziy uobIQ5fi8exrlAy3RGLHJ5JJ0x1zw68lro5kFhR9D8DSP+yNqninVZG7UwKSbuQb4dAT dnSw== |
| X-Received | by 10.50.130.98 with SMTP id od2mr5186522igb.21.1366826034918; Wed, 24 Apr 2013 10:53:54 -0700 (PDT) |
| MIME-Version | 1.0 |
| In-Reply-To | <09b96d6b-6db3-42a2-88d3-5fe16984fed1@googlegroups.com> |
| References | <09b96d6b-6db3-42a2-88d3-5fe16984fed1@googlegroups.com> |
| From | Chris “Kwpolska” Warrick <kwpolska@gmail.com> |
| Date | Wed, 24 Apr 2013 19:53:34 +0200 |
| Subject | Re: My gui |
| To | Daniel Kersgaard <danielkersgaard@gmail.com> |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | quoted-printable |
| Cc | 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.1026.1366826039.3114.python-list@python.org> (permalink) |
| Lines | 72 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1366826039 news.xs4all.nl 15917 [2001:888:2000:d::a6]:46234 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:44279 |
Show key headers only | View raw
On Wed, Apr 24, 2013 at 7:08 PM, Daniel Kersgaard
<danielkersgaard@gmail.com> wrote:
> Today, being the last day of lectures at school, my instructor ran briefly through Tkninter and GUIs. I'd been looking forward to this particular lesson all semester, but when I got home and copied a sample program from my textbook verbatim, IDLE does nothing. No error, no nothing. Any ideas? Here is the code from my program. I'm not sure if this is appropriate, but suggestions are helpful.
>
> import tkinter
> import tkinter.messagebox
>
> class MyGui:
> def _init_(self):
> self.main_window = tkinter.Tk()
>
> self.top_frame = tkinter.Frame(self.main_window)
> self.bottom_frame = tkinter.Frame(self.main_window)
>
> self.prompt_label = tkinter.Label(self.top_frame, text = 'Enter a distance in Kilometers: ')
> self.kilo_entry = tkinter.Entry(self.top_frame, width = 10)
>
> self.prompt_label.pack(side = 'left')
> self.kilo_entry.pack(side = 'left')
>
> self.calc_button = tkinter.Button(self.bottom_frame, text = 'Convert', command = self.convert)
>
> self.quit_button = tkinter.Button(self.bottom_frame, text = 'Quit', command = self.main_window.destroy)
>
> self.calc_button.pack(side = 'left')
> self.quit_button.pack(side = 'left')
>
> self.top_frame.pack()
> self.bottom_frame.pack()
>
> tkinter.mainloop()
>
> def convert(self):
> kilo = float(self.kilo_entry.get())
>
> miles = kilo * 0.6214
>
> tkinter.messagebox.showinfo('Result', str(kilo) + ' kilometers is equal to ' + str(miles) + 'miles.')
>
> poop = MyGui()
>
> --
> http://mail.python.org/mailman/listinfo/python-list
poop? Seriously? You aren’t serious about that copying, right?
Your code seems to be missing a lot of important stuff. You don’t
inherit from tkinter.Frame. Compare your program to the sample “Hello
world!” program:
http://docs.python.org/2/library/tkinter.html#a-simple-hello-world-program
— unfortunately, I am not a fan and I am not knowledgeable about
tkinter, but I can see a lot of stuff is missing.
Please try fixing it and running it _outside of IDLE_, which is also
built in Tk. This may cause problems (but don’t worry, the code you
pasted doesn’t work anyways.)
--
Kwpolska <http://kwpolska.tk> | GPG KEY: 5EAAEA16
stop html mail | always bottom-post
http://asciiribbon.org | http://caliburn.nl/topposting.html
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
My gui Daniel Kersgaard <danielkersgaard@gmail.com> - 2013-04-24 10:08 -0700
Re: My gui Dave Angel <davea@davea.name> - 2013-04-24 13:46 -0400
Re: My gui Chris “Kwpolska” Warrick <kwpolska@gmail.com> - 2013-04-24 19:53 +0200
Re: My gui Ned Batchelder <ned@nedbatchelder.com> - 2013-04-24 14:08 -0400
Re: My gui Arnaud Delobelle <arnodel@gmail.com> - 2013-04-24 20:42 +0100
Re: My gui Neil Cerutti <neilc@norwich.edu> - 2013-04-24 20:26 +0000
Re: My gui Terry Jan Reedy <tjreedy@udel.edu> - 2013-04-24 22:51 -0400
Re: My gui Chris Angelico <rosuav@gmail.com> - 2013-04-25 13:17 +1000
csiph-web