Hi ,<br><br>I am new one but ur talked make me laugh too :D , although here is relevant link for you <br><br>" if Tk cannot come up with an exact match, it tries to
find a similar font. If that fails, Tk falls back to a
platform-specific default font. Tk's idea of what is "similar
enough" probably doesn't correspond to your own view, so you
shouldn't rely too much on this feature."<br><br><a href="http://www.pythonware.com/library/tkinter/introduction/x444-fonts.htm">http://www.pythonware.com/library/tkinter/introduction/x444-fonts.htm</a><br><br>Hope it helps you <br>
<br><div class="gmail_quote">On Thu, Feb 10, 2011 at 9:55 PM,  <span dir="ltr"><<a href="mailto:python-list-request@python.org">python-list-request@python.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Send Python-list mailing list submissions to<br>
        <a href="mailto:python-list@python.org">python-list@python.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
        <a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
or, via email, send a message with subject or body 'help' to<br>
        <a href="mailto:python-list-request@python.org">python-list-request@python.org</a><br>
<br>
You can reach the person managing the list at<br>
        <a href="mailto:python-list-owner@python.org">python-list-owner@python.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of Python-list digest..."<br>
<br>Today's Topics:<br>
<br>
   1. Yappi error "context not found" (Brian)<br>
   2. Re: Markdown to reStructuredText (Michele Simionato)<br>
   3. Shared memory python between two separate shell-launched<br>
      processes (Charles Fox (Sheffield))<br>
   4. Re: Easy function, please help. (Jason Swails)<br>
   5. Re: Shared memory python between two separate shell-launched<br>
      processes (Jean-Paul Calderone)<br>
   6. Re: Problem with giant font sizes in tkinter (Cousin Stanley)<br>
   7. Re: email.encoders.encode_base64 creates one line only<br>
      (<a href="mailto:spam@uce.gov">spam@uce.gov</a>)<br>
   8. Re: OO Python (Dan Stromberg)<br>
   9. Re: Easy function, please help. (Ethan Furman)<br>
  10. Re: Problem with giant font sizes in tkinter (rantingrick)<br>
<br><br>---------- Forwarded message ----------<br>From: Brian <<a href="mailto:dribnairb@gmail.com">dribnairb@gmail.com</a>><br>To: <a href="mailto:python-list@python.org">python-list@python.org</a><br>Date: Thu, 10 Feb 2011 05:38:43 -0800 (PST)<br>
Subject: Yappi error "context not found"<br>I'm posting here because I can't find a Yappi specific mailing list.<br>
<br>
I've been using the rather brilliant Yappi from <a href="http://code.google.com/p/yappi/" target="_blank">http://code.google.com/p/yappi/</a><br>
It works well for small programs with a few threads. However, when<br>
trying to run it over large programs with several hundred threads I've<br>
been getting the error "context not found".<br>
<br>
The most basic example I can come up with which illustrates the<br>
problem is below. Changing the number of threads started from 25 down<br>
to, say, 10, works fine. Any more than ~25 and the error keeps<br>
appearing. This is using Python 2.6.5 and Ubuntu Linux 10.04. I don't<br>
have another box to try this out on at the moment.<br>
<br>
I've tested a similar script using thread.start_new_thread() and that<br>
doesn't seem to have the problem. So is there some issue with Yappi<br>
and inheriting from threading.Thread?<br>
<br>
import yappi<br>
import time<br>
import threading<br>
<br>
class MyThread(threading.Thread):<br>
    def run(self):<br>
        time.sleep(1)<br>
<br>
yappi.start()<br>
<br>
for i in range(0,25):<br>
    c = MyThread()<br>
    c.start()<br>
time.sleep(1)<br>
<br>
yappi.print_stats()<br>
yappi.stop()<br>
<br>
<br>
Running the above gives:<br>
[*]     [yappi-err]     context not found.<br>
[*]     [yappi-err]     context not found.<br>
[*]     [yappi-err]     context not found.<br>
[*]     [yappi-err]     context not found.<br>
...<br>
<br>
Any help appreciated.<br>
<br>
<br><br>---------- Forwarded message ----------<br>From: Michele Simionato <<a href="mailto:michele.simionato@gmail.com">michele.simionato@gmail.com</a>><br>To: <a href="mailto:comp.lang.python@googlegroups.com">comp.lang.python@googlegroups.com</a><br>
Date: Thu, 10 Feb 2011 00:03:19 -0800 (PST)<br>Subject: Re: Markdown to reStructuredText<br>Looks cool, I will have a look at it, thanks!<br>
<br>
<br><br>---------- Forwarded message ----------<br>From: "Charles Fox (Sheffield)" <<a href="mailto:charles.fox@gmail.com">charles.fox@gmail.com</a>><br>To: <a href="mailto:python-list@python.org">python-list@python.org</a><br>
Date: Thu, 10 Feb 2011 06:30:18 -0800 (PST)<br>Subject: Shared memory python between two separate shell-launched processes<br>Hi guys,<br>
I'm working on debugging a large python simulation which begins by<br>
preloading a huge cache of data.  I want to step through code on many<br>
runs to do the debugging.   Problem is that it takes 20 seconds to<br>
load the cache at each launch.  (Cache is a dict in a 200Mb cPickle<br>
binary file).<br>
<br>
So speed up the compile-test cycle I'm thinking about running a<br>
completely separate process (not a fork, but a processed launched form<br>
a different terminal) that can load the cache once then dunk it in an<br>
area of shareed memory.    Each time I debug the main program, it can<br>
start up quickly and read from the shared memory instead of loading<br>
the cache itself.<br>
<br>
But when I look at posix_ipc and POSH it looks like you have to fork<br>
the second process from the first one, rather than access the shared<br>
memory though a key ID as in standard C unix shared memory.  Am I<br>
missing something?   Are there any other ways to do this?<br>
<br>
thanks,<br>
Charles<br>
<br>
<br><br>---------- Forwarded message ----------<br>From: Jason Swails <<a href="mailto:jason.swails@gmail.com">jason.swails@gmail.com</a>><br>To: Benjamin Kaplan <<a href="mailto:benjamin.kaplan@case.edu">benjamin.kaplan@case.edu</a>><br>
Date: Thu, 10 Feb 2011 09:50:18 -0500<br>Subject: Re: Easy function, please help.<br><br><br><div class="gmail_quote">On Thu, Feb 10, 2011 at 3:31 AM, Benjamin Kaplan <span dir="ltr"><<a href="mailto:benjamin.kaplan@case.edu" target="_blank">benjamin.kaplan@case.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><div></div><div><br>
> On Wed, Feb 9, 2011 at 5:34 PM, MRAB <<a href="mailto:python@mrabarnett.plus.com" target="_blank">python@mrabarnett.plus.com</a>> wrote:<br>
<br>
>>> Or typecast to an int if you want to neglect decimals before converting<br>
>>> to a string, etc.<br>
>>><br>
>> [snip]<br>
>> Python doesn't have typecasting. :-)<br>
><br>
> Because these basic types are not mutable?  <excuse> Most of my work has to<br>
> be in Fortran, so I'm a relative newcomer to Python.  When I don't need<br>
> Fortran-y performance it's much nicer (obviously to anyone that's used them<br>
> both)!  Still don't know much deeper than Python's cosmetic surface at this<br>
> point. </excuse><br>
><br>
<br>
</div></div>Not exactly. It's because everything in Python is an object. What<br>
you're doing isn't type casting. It's just calling an object<br>
constructor- no different than any other class in the language.<br></blockquote><div><br>Ah, makes sense, thanks.  Most of what I see/work in is C and Fortran -- not much OOP there :)<br><br>--Jason<br><br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">


<div><div></div><div>--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Jason M. Swails<br>Quantum Theory Project,<br>University of Florida<br>Ph.D. Graduate Student<br>352-392-4032<br>
<br><br>---------- Forwarded message ----------<br>From: Jean-Paul Calderone <<a href="mailto:calderone.jeanpaul@gmail.com">calderone.jeanpaul@gmail.com</a>><br>To: <a href="mailto:python-list@python.org">python-list@python.org</a><br>
Date: Thu, 10 Feb 2011 07:43:54 -0800 (PST)<br>Subject: Re: Shared memory python between two separate shell-launched processes<br>On Feb 10, 9:30 am, "Charles Fox (Sheffield)" <<a href="mailto:charles....@gmail.com">charles....@gmail.com</a>><br>

wrote:<br>
> Hi guys,<br>
> I'm working on debugging a large python simulation which begins by<br>
> preloading a huge cache of data.  I want to step through code on many<br>
> runs to do the debugging.   Problem is that it takes 20 seconds to<br>
> load the cache at each launch.  (Cache is a dict in a 200Mb cPickle<br>
> binary file).<br>
><br>
> So speed up the compile-test cycle I'm thinking about running a<br>
> completely separate process (not a fork, but a processed launched form<br>
> a different terminal)<br>
<br>
Why _not_ fork?  Load up your data, then go into a loop forking and<br>
loading/<br>
running the rest of your code in the child.  This should be really<br>
easy to<br>
implement compared to doing something with shared memory, and solves<br>
the<br>
problem you're trying to solve of long startup time just as well.  It<br>
also<br>
protects you from possible bugs where the data gets corrupted by the<br>
code<br>
that operates on it, since there's only one copy shared amongst all<br>
your<br>
tests.  Is there some other benefit that the shared memory approach<br>
gives<br>
you?<br>
<br>
Of course, adding unit tests that exercise your code on a smaller data<br>
set<br>
might also be a way to speed up development.<br>
<br>
Jean-Paul<br>
<br>
<br><br>---------- Forwarded message ----------<br>From: Cousin Stanley <<a href="mailto:cousinstanley@gmail.com">cousinstanley@gmail.com</a>><br>To: <a href="mailto:python-list@python.org">python-list@python.org</a><br>
Date: Thu, 10 Feb 2011 15:48:47 +0000 (UTC)<br>Subject: Re: Problem with giant font sizes in tkinter<br>Steven D'Aprano wrote:<br>
<br>
> I have a tkinter application under Python 2.6 which is shows text<br>
> in a giant font, about twenty(?) times larger than expected.<br>
><br>
> The fonts are set using:<br>
><br>
> titlefont = '-Adobe-Helvetica-Bold-R-Normal-*-180-*'<br>
> buttonfont = '-Adobe-Helvetica-Bold-R-Normal-*-140-*'<br>
> labelfont = '-Adobe-Helvetica-Bold-R-Normal-*-140-*'<br>
> ....<br>
<br>
  Although I've been a linux user for several years,<br>
  that type of font spec hurts my head .... :-)<br>
<br>
  Will the more simplistic type of tuple spec<br>
  not work in your tkinter application ?<br>
<br>
  canv.create_text(<br>
     81 , 27 ,<br>
     text = ' NTSC Standard ' ,<br>
     fill = 'white' ,<br>
     font = ( 'Helvetica' , 12 , 'bold' ) )<br>
<br>
<br>
--<br>
Stanley C. Kitching<br>
Human Being<br>
Phoenix, Arizona<br>
<br>
<br>
<br><br>---------- Forwarded message ----------<br>From: <a href="mailto:spam@uce.gov">spam@uce.gov</a><br>To: <a href="mailto:python-list@python.org">python-list@python.org</a><br>Date: Thu, 10 Feb 2011 08:51:07 -0700<br>
Subject: Re: email.encoders.encode_base64 creates one line only<br><br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
This is with python 3.1.2 (r312:79147). I have not tried with 2.7.<br>
<br>
When I create an attachment with email.mime.image.MIMEImage, by default it<br>
uses email.encoders.encode_base64 for the encoder, but that results in a<br>
single line base64 string, instead of the recommended multiple 76-chars lines.<br>
<br>
This works with most MTA and MUA, but some of them choke on it.<br>
<br>
</blockquote>
<br>
In case somebody runs into the same issue:<br>
<a href="http://bugs.python.org/issue9298" target="_blank">http://bugs.python.org/issue9298</a><br>
<br>
And I added a work around if you need a solution before this bug is fixed at:<br>
<a href="http://bugs.python.org/issue11156#msg128213" target="_blank">http://bugs.python.org/issue11156#msg128213</a><br>
<br>
-- <br>
Yves.                                                  <a href="http://www.SollerS.ca/" target="_blank">http://www.SollerS.ca/</a><br>
                                                       <a href="http://blog.zioup.org/" target="_blank">http://blog.zioup.org/</a><br>
<br>
<br><br>---------- Forwarded message ----------<br>From: Dan Stromberg <<a href="mailto:drsalists@gmail.com">drsalists@gmail.com</a>><br>To: Paul Symonds <<a href="mailto:Paul.J.Symonds@gmail.com">Paul.J.Symonds@gmail.com</a>><br>
Date: Thu, 10 Feb 2011 08:36:29 -0800<br>Subject: Re: OO Python<br>On Wed, Feb 9, 2011 at 1:50 PM, Paul Symonds <<a href="mailto:Paul.J.Symonds@gmail.com">Paul.J.Symonds@gmail.com</a>> wrote:<br>
> Are there any good resources to learn OO Python from?<br>
<br>
Yes, plenty, but it's important for us to know so we can advise you:<br>
Do you know any other OO languages yet?<br>
<br>
<br><br>---------- Forwarded message ----------<br>From: Ethan Furman <<a href="mailto:ethan@stoneleaf.us">ethan@stoneleaf.us</a>><br>To: Jason Swails <<a href="mailto:jason.swails@gmail.com">jason.swails@gmail.com</a>>,  <a href="mailto:python-list@python.org">python-list@python.org</a><br>
Date: Thu, 10 Feb 2011 08:52:38 -0800<br>Subject: Re: Easy function, please help.<br>Jason Swails wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
On Wed, Feb 9, 2011 at 8:16 PM, Ethan Furman wrote:<br>
    while n:  is plenty readable.  n is either something or nothing, and<br>
    something evaluates to True, nothing to False.<br>
<br>
Sure it's readable.  But then you have to make sure that the loop will eventually take n down to 0.  <br>
</blockquote>
<br>
Sure, but the same holds true with 'while n != 0' -- you have to make sure the loop will eventually take n down to 0.<br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
You can always *assume* that the programmer knew what they were doing (not an assumption I'm typically willing to make on code that's not my own).<br>
</blockquote>
<br>
Hopefully not something you have to deal with unless you're debugging...<br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
How is "while n != 0:" any worse?  (or abs(n) < tolerance).  It has exactly the same effect without adding any code while at the same time directly communicates the intended conditional.  IMO it makes reading the code easier to read barring effective documentation (my experience with people documenting their code is that they don't; at least in my field).  "while n != 0" makes my life easier.<br>

</blockquote>
<br>
In that instance (a bunch of mathematical functions), I can easily see using that construct.<br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
The fact that the proposed loop finished with *nothing* was coincidental.  What if he had been doing some type of prime factorization or something where each iteration reduced the number until eventually all you were left with was the multiplicative identity?  You'd say (correctly) that obviously the same approach won't work, but in some lines of thought it's a logical extension to use the same construct (especially to those that don't fully understand why the original loop exits in the first place).  Expanding the conditional a little can only help IMO.<br>

</blockquote>
<br>
Thank you for making my argument for me -- you have to understand the tool you are using to make the best use of it.<br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
        def num_digits(n):<br>
          return len(str(n).replace('-','').replace('.',''))<br>
<br>
        Or typecast to an int if you want to neglect decimals before<br>
        converting to a string, etc.<br>
<br>
        Or use recursion!<br>
<br>
         >>> def num_digits(n):<br>
        ...    if n == 0:<br>
        ...       return 0<br>
        ...    else:<br>
        ...       return num_digits(n//10) + 1<br>
        ...<br>
         >>> num_digits(1)<br>
        1<br>
         >>> num_digits(0)<br>
        0<br>
<br>
<br>
    0 is still one digit.  ;)<br>
<br>
<br>
Well that is something; yet only nothing evaluates to False.  We seem to be at an impasse :).<br>
</blockquote>
<br>
I fail to see how a faulty algorithm puts us at an impasse.  To tweak your code:<br>
<br>
--> def num_digits(n, _first_pass=True):<br>
-->     if n == 0:<br>
-->         return int(_first_pass)<br>
-->     else:<br>
-->         return num_digits(n//10, _first_pass=False) + 1<br>
<br>
correctly handles the special case of zero.  To use my style, it would look like:<br>
<br>
--> def num_digits(n, _first_pass=True):<br>
-->     if n:<br>
-->         return num_digits(n//10, _first_pass=False) + 1<br>
-->     else:<br>
-->         return int(_first_pass)<br>
<br>
And, of course, this only works for non-negative integers.  (I'll leave the discussion of whether zero is non-negative to others.  ;)  As I said earlier, I can see using the 'if n == 0' construct in certain situations, and if the non-zero branch were lengthy I would stick with the first version here.<br>

<br>
~Ethan~<br>
<br>
<br><br>---------- Forwarded message ----------<br>From: rantingrick <<a href="mailto:rantingrick@gmail.com">rantingrick@gmail.com</a>><br>To: <a href="mailto:python-list@python.org">python-list@python.org</a><br>Date: Thu, 10 Feb 2011 08:52:19 -0800 (PST)<br>
Subject: Re: Problem with giant font sizes in tkinter<br>On Feb 10, 12:59 am, Steven D'Aprano <steve<br>
+<a href="mailto:comp.lang.pyt...@pearwood.info">comp.lang.pyt...@pearwood.info</a>> wrote:<br>
> I have a tkinter application under Python 2.6 which is shows text in a<br>
> giant font, about twenty(?) times larger than expected.<br>
><br>
> The fonts are set using:<br>
><br>
> titlefont = '-Adobe-Helvetica-Bold-R-Normal-*-180-*'<br>
> buttonfont = '-Adobe-Helvetica-Bold-R-Normal-*-140-*'<br>
> labelfont = '-Adobe-Helvetica-Bold-R-Normal-*-140-*'<br>
><br>
> On one PC (Fedora), the text is displayed fine. Running xlsfonts gives me<br>
> this:<br>
><br>
> $ xlsfonts -fn '-Adobe-Helvetica-Bold-R-Normal-*-140-*'<br>
> -adobe-helvetica-bold-r-normal--14-140-75-75-p-82-iso10646-1<br>
> -adobe-helvetica-bold-r-normal--14-140-75-75-p-82-iso8859-1<br>
> -adobe-helvetica-bold-r-normal--20-140-100-100-p-105-iso10646-1<br>
> -adobe-helvetica-bold-r-normal--20-140-100-100-p-105-iso8859-1<br>
><br>
> On a second PC (Ubuntu), the text is displayed in HUGE letters and I get<br>
> this from xlsfonts:<br>
><br>
> $ xlsfonts -fn '-Adobe-Helvetica-Bold-R-Normal-*-140-*'<br>
> -adobe-helvetica-bold-r-normal--14-140-75-75-p-82-iso10646-1<br>
> -adobe-helvetica-bold-r-normal--14-140-75-75-p-82-iso10646-1<br>
> -adobe-helvetica-bold-r-normal--14-140-75-75-p-82-iso8859-1<br>
> -adobe-helvetica-bold-r-normal--14-140-75-75-p-82-iso8859-1<br>
> -adobe-helvetica-bold-r-normal--20-140-100-100-p-105-iso10646-1<br>
> -adobe-helvetica-bold-r-normal--20-140-100-100-p-105-iso10646-1<br>
> -adobe-helvetica-bold-r-normal--20-140-100-100-p-105-iso8859-1<br>
> -adobe-helvetica-bold-r-normal--20-140-100-100-p-105-iso8859-1<br>
><br>
> I don't know how to diagnose or fix the problem. What should I do to fix<br>
> this problem?<br>
<br>
<br>
First let me stop laughing... hold on... yea just a minute... a little<br>
longer please... gawd i am enjoying this... ok i am ready... *pffftt*<br>
ha ha ha ha ha ha ha!<br>
<br>
I thought you hated Tkinter Steven? That is what you told this fine<br>
group many times anyway. Also on many occasions you have said that you<br>
have no use for GUI's, period. This is very interesting that know you<br>
cannot even draw text to preferred size.<br>
<br>
Oh, and about your problem. READ THE FREAKING MANUAL!<br>
<br>
<br>
<br>
<br>--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br></blockquote></div><br>