Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #42618 > unrolled thread

Re: Tkinter

Started byRenato Barbosa Pim Pereira <renato.barbosa.pim.pereira@gmail.com>
First post2013-04-02 23:04 -0300
Last post2013-04-02 23:04 -0300
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Tkinter Renato Barbosa Pim Pereira <renato.barbosa.pim.pereira@gmail.com> - 2013-04-02 23:04 -0300

#42618 — Re: Tkinter

FromRenato Barbosa Pim Pereira <renato.barbosa.pim.pereira@gmail.com>
Date2013-04-02 23:04 -0300
SubjectRe: Tkinter
Message-ID<mailman.31.1364954667.3114.python-list@python.org>

[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
>

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web