gui doubt
Andreas Tawn
andreas.tawn at ubisoft.com
Thu Jun 17 11:07:11 EDT 2010
> On 06/17/2010 01:04 AM, Stephen Hansen wrote:
> > On 6/16/10 10:40 PM, madhuri vio wrote:
> >> if i want to create a button
> >> which performs the transcription of dna to rna
> >> using tkinter in a gui...
> >> can u give me the method...
> >
> > You can not possibly be serious.
>
> Oh, it's not that bad....
>
> ########[dna2rna.py]##########
> import Tkinter as tk
>
> root = tk.Tk()
> root.title("dna2rna")
>
> def translate():
> from tkMessageBox import showinfo
> showinfo("Translate",
> "Do some translating here.\n"
> "Maybe in another thread so the GUI doesn't stall."
> )
> # do your actual work here
>
> tk.Button(
> root,
> text="Translate!",
> command=translate
> ).pack()
> root.mainloop()
> ##############################
>
> Now all one needs to do is fill in the blanks in the Translate
> call to do the actual work...an exercise left for the
> professional in the field. ;-) I suspect the GUI may need to be
> a bit more complex than that which might lead to wanting a more
> object-oriented code-base, but I leave that too as an exercise
> for the reader.
>
> -tkc
Seems like a simple problem... or am I missing something?
def translate():
return "dna".replace("d", "r")
Cheers,
Drea
More information about the Python-list
mailing list