Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.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.057 X-Spam-Evidence: '*H*': 0.89; '*S*': 0.00; 'tkinter': 0.07; 'width': 0.09; 'cc:addr:python-list': 0.11; 'def': 0.12; '24,': 0.16; 'frame,': 0.16; 'spotted': 0.16; 'stuff.': 0.16; 'subject:gui': 0.16; 'underscores': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'wed,': 0.18; 'bit': 0.19; 'seems': 0.21; 'command': 0.22; 'import': 0.22; 'cc:addr:gmail.com': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**1': 0.23; 'copied': 0.24; 'looks': 0.24; 'cc:no real name:2**0': 0.24; 'compare': 0.26; 'daniel': 0.26; 'header:In-Reply-To:1': 0.27; 'correct': 0.29; 'chris': 0.29; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'url:mailman': 0.30; 'code': 0.31; 'container': 0.31; 'helpful.': 0.31; 'class': 0.32; 'text': 0.33; 'url:python': 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; 'pm,': 0.38; 'does': 0.39; 'sure': 0.39; 'url:mail': 0.40; 'skip:t 30': 0.61; 'today,': 0.61; 'forward': 0.65; 'distance': 0.65; 'skip:\xe2 10': 0.65; 'to:addr:gmail.com': 0.65; 'here': 0.66; 'sample': 0.67; 'home': 0.69; '8bit%:43': 0.74; 'unusual': 0.74; 'day': 0.76; 'textbook': 0.84; 'don\xe2\x80\x99t': 0.91; 'serious': 0.97; '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:content-transfer-encoding; bh=v5XOv6sw6wUiPMHdxhNYLsW1SeRjXZ+x6IEZkZCpFgI=; b=MpPk8cHONZXIz3/qFV4kzgO+3LMRb0HnVFz3HM21ibNe36NiRQOPj63SYddY+M50cf GhykbgB2d6t4f822V08qTf93Eu4AbfajvKT0kIFMbWCC+sjZJwq5EAqhS9MQizooGaGR C4QR+kxQwYba2H5F6g2xBwuijk+G5VpvSB2J5k4dPuigxF6WRJVWtvemlG5XcGQwCIBv 2pUWw/4V1BAb1PJw2fbUg+nu0+jFHscV0IvAZk+sgZ179bIHXcHZVuUSEi/ZTcoXQRlt cLKhyEi6Rvuvzwz1gB72ops0zIRmDnyBOEMMb3Ta9cTAvhfFEJT5NRQEk2Vc2WsJWbGd g5pg== MIME-Version: 1.0 X-Received: by 10.112.147.99 with SMTP id tj3mr18264440lbb.94.1366832569129; Wed, 24 Apr 2013 12:42:49 -0700 (PDT) In-Reply-To: References: <09b96d6b-6db3-42a2-88d3-5fe16984fed1@googlegroups.com> Date: Wed, 24 Apr 2013 20:42:48 +0100 Subject: Re: My gui From: Arnaud Delobelle To: =?UTF-8?B?Q2hyaXMg4oCcS3dwb2xza2HigJ0gV2Fycmljaw==?= Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: python-list@python.org, Daniel Kersgaard 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: 69 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1366832576 news.xs4all.nl 15900 [2001:888:2000:d::a6]:44458 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:44288 On 24 April 2013 18:53, Chris =E2=80=9CKwpolska=E2=80=9D Warrick wrote: > On Wed, Apr 24, 2013 at 7:08 PM, Daniel Kersgaard > wrote: >> Today, being the last day of lectures at school, my instructor ran brief= ly through Tkninter and GUIs. I'd been looking forward to this particular l= esson 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? Her= e is the code from my program. I'm not sure if this is appropriate, but su= ggestions are helpful. >> >> import tkinter >> import tkinter.messagebox >> >> class MyGui: >> def _init_(self): >> self.main_window =3D tkinter.Tk() >> >> self.top_frame =3D tkinter.Frame(self.main_window) >> self.bottom_frame =3D tkinter.Frame(self.main_window) >> >> self.prompt_label =3D tkinter.Label(self.top_frame, text =3D 'En= ter a distance in Kilometers: ') >> self.kilo_entry =3D tkinter.Entry(self.top_frame, width =3D 10) >> >> self.prompt_label.pack(side =3D 'left') >> self.kilo_entry.pack(side =3D 'left') >> >> self.calc_button =3D tkinter.Button(self.bottom_frame, text =3D = 'Convert', command =3D self.convert) >> >> self.quit_button =3D tkinter.Button(self.bottom_frame, text =3D = 'Quit', command =3D self.main_window.destroy) >> >> self.calc_button.pack(side =3D 'left') >> self.quit_button.pack(side =3D 'left') >> >> self.top_frame.pack() >> self.bottom_frame.pack() >> >> tkinter.mainloop() >> >> def convert(self): >> kilo =3D float(self.kilo_entry.get()) >> >> miles =3D kilo * 0.6214 >> >> tkinter.messagebox.showinfo('Result', str(kilo) + ' kilometers i= s equal to ' + str(miles) + 'miles.') >> >> poop =3D MyGui() >> >> -- >> http://mail.python.org/mailman/listinfo/python-list > > poop? Seriously? You aren=E2=80=99t serious about that copying, right? > > Your code seems to be missing a lot of important stuff. You don=E2=80=99= t > inherit from tkinter.Frame. Compare your program to the sample =E2=80=9C= Hello > world!=E2=80=9D program: His class is not a frame, it's just a container for the tkinter code. It's a bit unusual but it looks correct to me (apart from the single underscores in __init__() as spotted by Ned Batchelder). --=20 Arnaud