Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #42618
| References | <CAHq3d9C_ruMdbhc2vWZJCRDh=o4yQhEm33r=CMp9rbzqGYdx6g@mail.gmail.com> <CAEk9e3o=CzSeHD902DmMiVgXY0ZK1S4wLnDY0DOQw1Ab03QKXA@mail.gmail.com> <CAHq3d9Cfudq1RpvAnuGEjr4PWjuqqaskqerDHa_OLSYnJhb6dw@mail.gmail.com> <CAEk9e3p097wC0dHagQe_=9CTYkYVyH-TMmLZ-Lf7=WRMUf5_DQ@mail.gmail.com> |
|---|---|
| Date | 2013-04-02 23:04 -0300 |
| Subject | Re: Tkinter |
| From | Renato Barbosa Pim Pereira <renato.barbosa.pim.pereira@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.31.1364954667.3114.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
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 <jason.swails@gmail.com>
> 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 Renato Barbosa Pim Pereira <renato.barbosa.pim.pereira@gmail.com> - 2013-04-02 23:04 -0300
csiph-web