Tkinter
Renato Barbosa Pim Pereira
renato.barbosa.pim.pereira at gmail.com
Tue Apr 2 22:04:25 EDT 2013
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 at 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 at 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130402/f61e204e/attachment.html>
More information about the Python-list
mailing list