Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #42587
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <jason.swails@gmail.com> |
| 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; 'python': 0.11; 'def': 0.12; 'project,': 0.12; 'assume': 0.14; '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; 'subject:Tkinter': 0.16; 'tk()': 0.16; 'to:name:python list': 0.16; 'wrote:': 0.18; 'do.': 0.18; 'variable': 0.18; 'module': 0.19; 'trying': 0.19; 'input': 0.22; 'import': 0.22; 'entries': 0.24; 'finally,': 0.24; 'ph.d.': 0.24; '\xa0so': 0.24; 'task': 0.26; 'this:': 0.26; 'pass': 0.26; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'to:2**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; 'skip:c 30': 0.32; 'skip:m 30': 0.32; 'guess': 0.33; 'lab': 0.33; 'skip:t 40': 0.33; 'candidate': 0.34; '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; '8bit%:4': 0.38; 'bringing': 0.38; 'jason': 0.38; 'window': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; '\xa0\xa0\xa0': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'university': 0.39; 'called': 0.40; 'tell': 0.60; 'skip:t 30': 0.61; 'skip:n 10': 0.64; 'to:addr:gmail.com': 0.65; 'media': 0.66; '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:content-type; bh=QUFzr0QN2wkyMiJXWkKrg/R40a3K/kfYxXYus6CWcfw=; b=m5qbkDosPWjb9AFvfEtszTr7GXleulwwgfY2pelACqObZTa+Fzl3C75HT199ro1CXb H9WYDdPoB15O24xD5jg0hyluW1aXnWYZ0IjxtqkqRBGkZYdkkZujZpRKOylf4R5YawLY PqQCB6LfDN8k5oiuetXuTWGshoUMDGFDDTE1jdi6xT4NbqlsL1Vo5euJwFFK4ZxJA8ci TVfSYU3b9c/1wXTO+KZbpKBy3nQSMOTBqlObL89/5ckp598Fdpx8svvK128f3Yb7El1e 7O42zWq2sYPVdKWlyt7xppnfr+CEUDazh+2SmE97qFvjf5D371vs0OuMFr8gqWMAbdSc G6eg== |
| MIME-Version | 1.0 |
| X-Received | by 10.50.190.233 with SMTP id gt9mr5460757igc.80.1364919099272; Tue, 02 Apr 2013 09:11:39 -0700 (PDT) |
| In-Reply-To | <CAHq3d9Cfudq1RpvAnuGEjr4PWjuqqaskqerDHa_OLSYnJhb6dw@mail.gmail.com> |
| References | <CAHq3d9C_ruMdbhc2vWZJCRDh=o4yQhEm33r=CMp9rbzqGYdx6g@mail.gmail.com> <CAEk9e3o=CzSeHD902DmMiVgXY0ZK1S4wLnDY0DOQw1Ab03QKXA@mail.gmail.com> <CAHq3d9Cfudq1RpvAnuGEjr4PWjuqqaskqerDHa_OLSYnJhb6dw@mail.gmail.com> |
| Date | Tue, 2 Apr 2013 12:11:39 -0400 |
| Subject | Re: Tkinter |
| From | Jason Swails <jason.swails@gmail.com> |
| To | Renato Barbosa Pim Pereira <renato.barbosa.pim.pereira@gmail.com>, python list <python-list@python.org> |
| Content-Type | multipart/alternative; boundary=14dae93411770f352c04d962fefa |
| 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.15.1364919108.3114.python-list@python.org> (permalink) |
| Lines | 189 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1364919108 news.xs4all.nl 6976 [2001:888:2000:d::a6]:53851 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:42587 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
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
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Tkinter Jason Swails <jason.swails@gmail.com> - 2013-04-02 12:11 -0400
csiph-web