Tkinter and printf in C ...

Steve Holden sholden at holdenweb.com
Mon Jul 9 13:59:06 CEST 2001


Chyr-Pyng:

That's why my first example was over-complicated. I was displaying email
messages parsed from a file after selection from a list item. All that code
was highly specific to my program, and shouldn't be expected to make much
sense to you. It's the insert() method of the Text and scrolledText objects
I ws trying to pint you at!

regards
 Steve
--
http://www.holdenweb.com/


"Chyr-Pyng Su" <cpsu at larc.ee.nthu.edu.tw> wrote in message
news:3B4943F0.35F0FADA at larc.ee.nthu.edu.tw...
> > OK, I was running a little too fast. The "self" in the code I showed you
> > referred to the object whose class implementation I had extracted the
code
> > from, so you all you need to know is that is was the parent of the
> > Pmw.ScrolledText object in which I was rendering text.
> >
> > Suppose that the error message returned by the wrapped C function has
been
> > stored in st. To create a Text widget in a separate top-level window and
> > display the message in it, you would do (something like: warning,
untested):
> >
> >         msgWindow = Toplevel(height=350, width=500)
> >         msgWindow.columnconfigure(0, weight=1)
> >         msgWindow.rowconfigure(0, weight=1)
> >         t = Text(msgWindow)
> >         grid(t, row=0, column=0, sticky=N+E+W+S)
> >         t.insert(END, st)
> >
> > I have here assumed that like most Tkinter programmers you have used
"from
> > Tkinter import *", and that you are using (or are prepared to use) the
grid
> > geometry management.
> >
> > Does this make it any clearer?
> >
> > regards
> >  Steve
> > --
> > http://www.holdenweb.com/
>
>  :>  I know 'self', but the question is 'index' .  The following code
segment
> is what I really
> interesting. That is, how to catch the message that transfer from wrapped
c
> function.
>
> strmes =
> self.index.Message(self.MsgSet[int(self.msgList.curselection()[0])][0])
>                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>         message = mimecntl.MIME_document(strmes)
>                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
>         for hdr in ("from", "date", "subject", "to", "cc"):
>              try:
>                  hdrline = message[hdr]
>                  t.insert(END, "%s:     %s\n" %
> (string.capitalize(hdr),hdrline))
>              except KeyError:
>                  pass
>
> From my experiment, Using Pmw package to write my GUI, the dumped message
from
> C
> will popup a error message dialog, but this won't happen when I implement
GUI
> in original Tkinter package.  Could you explain the MsgSet..
MIME_document...
> these functions..
> or tell me where to find related document that describe those mechanism,
so
> that I can study
> it. I can't find these stuff in Pmw or Tkinter document... :p
>
> Thanks....
>
>
>
> --
>  Ĭ«ù¥­   Su, Chyr-Pyng                               o888o V o888o
>  VLSI Design, Testing and Fault Tolerance Lab.       o8 ~__   __  8o
>  EE. National Tsing Hau Univ. Taiwan                 88o   ooo   o88
>                                                         o 8^ ^8 o
>  E-Mail: cpsu at larc.ee.nthu.edu.tw                    /- 88_____88 -\
>  WWW:    http://larc.ee.nthu.edu.tw/~cpsu            _\   qioip   /_
>
>
>





More information about the Python-list mailing list