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: 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: =?UTF-8?B?Q2hyaXMg4oCcS3dwb2xza2HigJ0gV2Fycmljaw==?= Date: Wed, 24 Apr 2013 19:53:34 +0200 Subject: Re: My gui To: Daniel Kersgaard 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 On Wed, Apr 24, 2013 at 7:08 PM, Daniel Kersgaard wrote: > Today, being the last day of lectures at school, my instructor ran briefl= y through Tkninter and GUIs. I'd been looking forward to this particular le= sson 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 sug= gestions 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 'Ent= er 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 is= 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=99t inherit from tkinter.Frame. Compare your program to the sample =E2=80=9CHe= llo world!=E2=80=9D program: http://docs.python.org/2/library/tkinter.html#a-simple-hello-world-program =E2=80=94 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=E2=80=99t worry, the code yo= u pasted doesn=E2=80=99t work anyways.) -- Kwpolska | GPG KEY: 5EAAEA16 stop html mail | always bottom-post http://asciiribbon.org | http://caliburn.nl/topposting.html