Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.mixmin.net!eweka.nl!hq-usenetpeers.eweka.nl!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'insert': 0.05; 'context': 0.07; 'responding': 0.07; 'tkinter': 0.07; '%s"': 0.09; 'cc:addr :python-list': 0.11; 'python': 0.11; 'def': 0.12; 'project,': 0.12; 'assume': 0.14; 'cc:name:python list': 0.16; 'elementos': 0.16; 'luck,': 0.16; 'luckily,': 0.16; 'namespace.': 0.16; 'numero': 0.16; 'numpy': 0.16; 'quantum': 0.16; 'renamed': 0.16; 'responses.': 0.16; 'screen,': 0.16; 'scrollbar': 0.16; 'subject:Tkinter': 0.16; 'tk()': 0.16; 'wrote:': 0.18; 'do.': 0.18; 'variable': 0.18; 'module': 0.19; 'trying': 0.19; 'input': 0.22; 'import': 0.22; 'email addr:gmail.com>': 0.22; 'cc:addr:python.org': 0.22; 'entries': 0.24; 'finally,': 0.24; 'ph.d.': 0.24; 'cc:2**0': 0.24; 'task': 0.26; 'this:': 0.26; 'pass': 0.26; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'leave': 0.29; 'am,': 0.29; 'label': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'gives': 0.31; 'this.': 0.32; 'skip:c 30': 0.32; 'skip:m 30': 0.32; 'guess': 0.33; 'lab': 0.33; 'skip:t 40': 0.33; 'candidate': 0.34; 'created': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'version': 0.36; '(e.g.,': 0.36; 'replies': 0.36; 'thanks': 0.36; 'should': 0.36; 'list': 0.37; 'skip:& 10': 0.38; 'bringing': 0.38; 'jason': 0.38; 'window': 0.38; 'does': 0.39; 'sure': 0.39; 'university': 0.39; 'called': 0.40; 'skip:\xc2 10': 0.60; 'tell': 0.60; 'skip:t 30': 0.61; 'skip:n 10': 0.64; 'to:addr:gmail.com': 0.65; 'media': 0.66; '8bit%:100': 0.72; 'click': 0.77; 'florida': 0.78; 'responses': 0.93; '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=Z9DUMcivL2lGzz8CP4BhVmK0XkkXvyyPOfS6uishAM4=; b=0juuLIE1dL9IJxfN3ZkKR0Y6mPKqaBfNDPTkWjEVFEQSyHUYjc6pSVIdp1gqp3ITam 8+2ABvA97DpQOhiX9j/gfTbqWjq+z2OeJO2xRT+488nIVZJkSPuR4kXN0rZRabPzvy10 z28H//7K0PmB3rEpgQsdKge6uCTqWIWA72lOBQ/D0djnrIAy5RMVymk35nwxxzWuk/wI 45TxzwxH33Q9HNUCm1gQLf4BJjMfvPIGC9GyP872jJTKXxjxhgU6x/NVTm1VU4J6O88A 55XnY6eivYv6pqX40hGjTQKGWRJ+2Is3V1B46rZNUTvPUH13js6xo01LqaHwrcmeb6fH R2vQ== MIME-Version: 1.0 X-Received: by 10.180.108.106 with SMTP id hj10mr6701250wib.0.1364954665702; Tue, 02 Apr 2013 19:04:25 -0700 (PDT) In-Reply-To: References: Date: Tue, 2 Apr 2013 23:04:25 -0300 Subject: Re: Tkinter From: Renato Barbosa Pim Pereira To: Jason Swails Content-Type: multipart/alternative; boundary=e89a8f3bb03dfbdb0304d96b45e7 Cc: python list 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: 220 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1364954667 news.xs4all.nl 6873 [2001:888:2000:d::a6]:47076 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:42618 --e89a8f3bb03dfbdb0304d96b45e7 Content-Type: text/plain; charset=UTF-8 Thanks for the advices, I need now one scrollbar to roll under screen, I created the scrollbar but cant roll, please help me on this. http://pastebin.com/L6XWY6cm 2013/4/2 Jason Swails > Please keep response replies to the Python list (e.g., use 'reply all' or > just send the email to python-list). > > Also, you should tell people what Python version you are using. I assume > you are using Python 2 since Tkinter was renamed to tkinter in Python 3. > > Finally, do not top-post. Type your responses inside the body of the > email you are responding to. That gives people context for your responses. > > On Tue, Apr 2, 2013 at 11:48 AM, Renato Barbosa Pim Pereira < > renato.barbosa.pim.pereira@gmail.com> wrote: > >> Sorry for my inconsistence: >> >> I need a textbox to get one number and pass for variable called numero >> with one click of button. Thanks . >> >> I have this: >> >> import numpy as np >> import matplotlib.pyplot as plt >> from Tkinter import * >> import tkMessageBox >> >> prefixo = "vetor" >> numero = 10 >> numeroVetores = 0 >> >> def makeWidgets(numero): >> global entries >> window = Tk() >> window.title('Vetores') >> form = Frame(window) >> form.pack() >> entries = {} >> for ix in range(numero): >> label = "%s %s" % (prefixo , ix + 1) >> lab = Label(form, text=label) >> ent = Entry(form) >> lab.grid(row=ix, column=0) >> ent.grid(row=ix, column=1) >> entries[label] = ent >> >> >> >> >> >> Button(window, text="Calcular", command=calcular).pack(side=LEFT) >> Button(window, text="Media", command=media).pack(side=LEFT) >> >> >> >> return window >> >> >> >> def pegavalores(): >> valores = [] >> for chave, entrada in sorted(entries.items()): >> valores.append(entrada.get()) >> >> return valores >> >> >> def calcular(): >> calcular = pegavalores() >> plt.plot(calcular) >> plt.show() >> >> def media(): >> media = pegavalores() >> elementos = len(media) >> media = np.asarray(media, dtype=np.float64) >> valormedio = np.sum(media)/elementos >> tkMessageBox.showinfo("Media", valormedio) >> >> >> window = makeWidgets(numero) >> window.mainloop() >> > > I'm not sure exactly what you are trying to do. My guess is that you want > to get "numero" from user input. Luckily, the tkSimpleDialog module > contains a handy function that does just this: askinteger. So add a call: > > numero = tkSimpleDialog.askinteger('Window Title', 'Please insert the > number of input values you want') > window = makeWidgets(numero) > window.mainloop() > > I leave to you the task of bringing tkSimpleDialog into your namespace. > > Good luck, > Jason > -- > Jason M. Swails > Quantum Theory Project, > University of Florida > Ph.D. Candidate > 352-392-4032 > --e89a8f3bb03dfbdb0304d96b45e7 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Thanks for the advices, I need now one scrollbar to roll u= nder screen, I created the scrollbar but cant roll, please help me on this.=

http://pastebin.com/L6XWY6= cm


2013/4/= 2 Jason Swails <jason.swails@gmail.com>
Please keep response re= plies to the Python list (e.g., use 'reply all' or just send the em= ail to python-list).

Also, you sho= uld tell people what Python version you are using. I assume you are using P= ython 2 since Tkinter was renamed to tkinter in Python 3.

Finally, do not top-post. =C2=A0Type your responses inside the body of= the email you are responding to. =C2=A0That gives people context for your = responses.

On Tue, Apr 2, 2013 at 11:48 AM, Renato Barbosa Pim Per= eira <renato.barbosa.pim.pereira@gmail.com> wrote:
Sorry for my inconsist= ence:

I need a textbox to get one number and pass for var= iable called numero with one click of button. Thanks .

I have this:

import numpy as np
import matplotlib.pyplot as plt
from Tkinter import *
import tkMessag= eBox

prefixo =3D "vetor"
numero =3D 10
numeroVetores= =3D 0

def makeWidgets(numero):
=C2=A0=C2=A0=C2=A0 global entries=
=C2=A0=C2=A0=C2=A0 window =3D Tk()
=C2=A0=C2=A0=C2=A0 window.title('Vetores')
=C2=A0=C2=A0=C2=A0 fo= rm =3D Frame(window)
=C2=A0=C2=A0=C2=A0 form.pack()
=C2=A0=C2=A0=C2= =A0 entries =3D {}
=C2=A0=C2=A0=C2=A0 for ix in range(numero):
=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 label =3D "%s %s" % (prefixo= , ix + 1)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 lab =3D Label(form= , text=3Dlabel)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ent =3D Entry(form)
=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 lab.grid(row=3Dix, column=3D0)
=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ent.grid(row=3Dix, column=3D1)
=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 entries[label] =3D ent
=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
=C2=A0=C2=A0=C2= =A0
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
=C2=A0=C2=A0=C2=A0 B= utton(window, text=3D"Calcular",=C2=A0 command=3Dcalcular).pack(s= ide=3DLEFT)
=C2=A0=C2=A0=C2=A0 Button(window, text=3D"Media",=C2=A0 command= =3Dmedia).pack(side=3DLEFT)

=C2=A0=C2=A0=C2=A0

=C2=A0=C2=A0= =C2=A0 return window



def pegavalores():
=C2=A0=C2=A0=C2= =A0 valores =3D []
=C2=A0=C2=A0=C2=A0 for chave, entrada in sorted(entri= es.items()):
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 valores.append(entrada.get())
=C2=A0=C2=A0=C2=A0 return valores


def calcular():
=C2=A0= =C2=A0=C2=A0 calcular =3D pegavalores()
=C2=A0=C2=A0=C2=A0 plt.plot(calc= ular)
=C2=A0=C2=A0=C2=A0 plt.show()

def media():
=C2=A0=C2=A0= =C2=A0 media =3D pegavalores()
=C2=A0=C2=A0=C2=A0 elementos =3D len(medi= a)
=C2=A0=C2=A0=C2=A0 media =3D np.asarray(media, dtype=3Dnp.float64)
=C2= =A0=C2=A0=C2=A0 valormedio =3D np.sum(media)/elementos
=C2=A0=C2=A0=C2= =A0 tkMessageBox.showinfo("Media", valormedio)


window = =3D makeWidgets(numero)
window.mainloop()

= I'm not sure exactly what you are trying to do. =C2=A0My guess is that = you want to get "numero" from user input. =C2=A0Luckily, the tkSi= mpleDialog module contains a handy function that does just this: askinteger= . =C2=A0So add a call:

numero =3D tkSimpleDialog.askinteger('Window Title', 'Plea= se insert the number of input values you want')
window =3D makeWidgets(numero)
window.mainloop()

I leave to you the task of bringing tkSi= mpleDialog into your namespace.
Good luck,
Jason
-- Jason M. Swails
Quantum Theory Project,
University of Florida
Ph.D. Candidate
352-392-4032

--e89a8f3bb03dfbdb0304d96b45e7--