Re: Submission for Python Limmerick Contest
a penguin, a gnu and a snake and an X animal participate in a poem contest. who will win? Ellipsis -- nirinA -- -- http://mail.python.org/mailman/listinfo/python-list
Re: Submission for Python Limmerick Contest
> A tuple, a dict, and a list, > And whitespace which mus'n't be missed. > Imported together, > And stirred with a feather, > Yields a language whose name must be hissed! A char, an integer and a float, And a decimal which precision is fixed Computerised altogether Then shaked down with a mixer Asserts a community whose goal must be attained! -- -- http://mail.python.org/mailman/listinfo/python-list
Re: Listbox fill=BOTH expand=YES (Tkinter)
"Christos TZOTZIOY Georgiou" wrote: > > the 'in' operator searches for existance of *elements* in a set, not > of *subsets*. BTW, only a frozenset can be included in a set. ah! yes. that's clear now. thanks! after all: >>> for element in aset: print element, why did i think that 'in' was another different operator? the test should be then: >>> 'TRUE' in dir(Tkconstants) and 'YES' in dir(Tkconstants) True and then: >>> 'inexistent keyword' in dir(Tkconstants) and 'YES' in dir(Tkconstants) False a bit cumbersome if there is a lot of keys to test. i also found in the itertools-recipes the way to avoid the reduce-lambda construction i had previously in head: >>> from itertools import * >>> def all(seq, pred=bool): "Returns True if pred(x) is True for every element in the iterable" for elem in ifilterfalse(pred, seq): return False return True >>> all(i in dir(Tkconstants) for i in ['TRUE', 'YES']) True >>> all(i in dir(Tkconstants) for i in ['TRUE', 'YES', 'inexistent key']) False lovely... i do not regret the fate of reduce et al. > > To check for subsets, either use the issubset function, or the '<' operator (I > believe they both call the same code): > > .>> set(['TRUE','YES']).issubset(set(dir(Tkconstants))) > True > > can be expressed as > > .>> set(['TRUE','YES']) < set(dir(Tkconstants)) > True i noted! thanks again. -- nirinA -- -- http://mail.python.org/mailman/listinfo/python-list
Re: Listbox fill=BOTH expand=YES (Tkinter)
"Christos TZOTZIOY Georgiou" wrote: > On Tue, 15 Mar 2005 16:48:17 +0300, > rumours say that [i] might have written: > > >yes, indeed. > import Tkconstants > 'True' and 'YES' in dir(Tkconstants) > >True > > > >thanks Harlin, > > I hope you also know that > > .>> 'inexistent keyword' and 'YES' in dir(Tkconstants) > > is also True... yeah, known but forgotten. hmmm ... let's try : >>> import Tkconstants >>> 'YES' in dir(Tkconstants) True >>> 'True' in dir(Tkconstants) False >>> 'TRUE' in dir(Tkconstants) True >>> ('inexistent keyword') in dir(Tkconstants) False so >>> 'TRUE' and 'YES' in dir(Tkconstants) True >>> 'inexistent keyword' and 'YES' in dir(Tkconstants) True i'll recite 42 times truth tables before going to bed. however i didn't expect the following: >>> 'inexistent keyword' or 'YES' in dir(Tkconstants) 'inexistent keyword' >>> False or 'YES' in dir(Tkconstants) True hmmm... >>> ('inexistent keyword' or 'YES') in dir(Tkconstants) False >>> (False or 'YES') in dir(Tkconstants) True i'll recite 42 times precedence rules before going to bed. but now i'm a bit confused by the -in- operator. as: >>> set(['TRUE','YES']).issubset(set(dir(Tkconstants))) True i expected this to be true, but it's not: >>> set(['TRUE','YES']) in set(dir(Tkconstants)) False originaly, i'm thinking to short-cut the following, >>> reduce(lambda t,f: t and f, [i in dir(Tkconstants) for i in 'YES','inexistent keyword']) False >>> reduce(lambda t,f: t and f, [i in dir(Tkconstants) for i in 'TRUE','YES']) True but that was too short and i miss something! i do reset my brain somewhere between cell234 and cell241 thanks for reading! -- nirinA -- -- http://mail.python.org/mailman/listinfo/python-list
Re: distutils setup ignoring scripts
"Jack Orenstein" wrote: > Quoting [i]: > > as you use Python22 on RH9, maybe: > > python setup.py bdist_rpm --install-script foobar > > Is install-script really needed? I would have thought that specifying > setup( ... scripts = [...] ...) would suffice, based on the python > docs. > i think you need to precise it, and even with some other rpm specific options like: --use-rpm-opt-flags but ... i'm not sure that those options are already implemented with Python22. if not you may have to upgrade! -- nirinA -- http://mail.python.org/mailman/listinfo/python-list
Re: distutils setup ignoring scripts
"Jack Orenstein" wrote: > No, I'm referring to bin/foobar, as specified > in "scripts = ['bin/foobar']". yes i'm deadly wrong and should refuse the temptation to guess! and ougth to read clearly the post. so, you want the script foobar included in your package? what command are you issueing? does this include the file? python setup.py sdist as you use Python22 on RH9, maybe: python setup.py bdist_rpm --install-script foobar > Jack -- nirinA -- i ougth to read clearly the post and should refuse the temptation to guess! -- http://mail.python.org/mailman/listinfo/python-list
Re: distutils setup ignoring scripts
Jack wrote: > No, I'm referring to bin/foobar, as specified > in "scripts = ['bin/foobar']". yes i'm deadly wrong and should refuse the temptation to guess! and ougth to read clearly the post. so, you want the script foobar included in your package? what command are you issueing? does this include the file? python setup.py sdist as you use Python22 on RH9, maybe: python setup.py bdist_rpm --install-script foobar > Jack -- nirinA -- http://mail.python.org/mailman/listinfo/python-list
Re: distutils setup ignoring scripts
yes i'm deadly wrong and should refuse the temptation to guess! and ougth to read clearly the post. > > No, I'm referring to bin/foobar, as specified > in "scripts = ['bin/foobar']". > > Jack so, you want the script foobar included in your package? what command are you issueing? does this include the file? python setup.py sdist as you use Python22 (old) on RH9, maybe: python setup.py bdist_rpm --install-script foobar -- nirinA -- -- http://mail.python.org/mailman/listinfo/python-list
Re: Listbox fill=BOTH expand=YES (Tkinter)
"Harlin Seritt" wrote: > either YES, True, or 1 should work. > yes, indeed. >>> import Tkconstants >>> 'True' and 'YES' in dir(Tkconstants) True thanks Harlin, -- nirinA -- http://mail.python.org/mailman/listinfo/python-list
Re: distutils setup ignoring scripts
"Jack Orenstein" wrote: > I'm using Python 2.2 on RH9. I have a set of Python modules > organized > into a root package and one other package named foobar. setup.py > looks > like this: > > from distutils.core import setup > > setup( > name = 'foobar', > version = '0.3', > description = 'Foo Bar', > author = 'Jack Orenstein', > author_email = '[EMAIL PROTECTED]', > packages = ['', 'xyz'], > scripts = ['bin/foobar'] > ) > > The resulting package has everything in the specified directories, > but > does not include the script. I've tried making the path bin/foobar > absolute, but that doesn't help. I've googled for known bugs of this > sort but have come up emtpy. (The first line of bin/foobar is > #!/usr/bin/python.) > > I've also tried using DISTUTIL_DEBUG, which has been uninformative, > (e.g. no mention of bin/foobar at all). > > Can anyone see what I'm doing wrong? i think there's nothing wrong. the script (i guess you mean the setup.py file) is not included into the package because you haven't specified it to be so. add: setup( ... py_modules=["setup"], ... ) inside your script to perform inclusion. another way to include other files not specified by the setup script is to write a MANIFEST where you indicate those files. then build the package with the sdist command: $ cat > MANIFEST bin/foobar bin/anotherfoobar anotherbin/barfoo setup.py MANIFEST ctrl-D $ python setup.py sdist > > Jack Orenstein > hope this helps. -- nirinA -- http://mail.python.org/mailman/listinfo/python-list
Re: Listbox fill=BOTH expand=YES (Tkinter)
"Martin Franklin" wrote: > Harlin Seritt wrote: > > I am trying the following: > > > > Listbox(parent).pack(fill=BOTH, expand=YES) > > > > I notice that the listbox will fill on the X axis but will not on > > the Y axis unlike other widgets. > > Is there any way to force this? > > > > thanks, > > > > Harlin > > > > Harlin, > > It should expand (and fill ) in both directions have you checked > it's parents packing options? > > Martin > is YES a valid flag for expand? maybe expand=1 -- nirinA -- http://mail.python.org/mailman/listinfo/python-list
Re: A Font Dialog (Tkinter)
"Harlin Seritt" wrote: > Is there a way to call up the Font dialog box (at least in the > Windows API) from Tkinter or another module? > i'll use the tkFont module and the same way as IDLE calls it. looking at the source code may help you: >>> import tkFont, idlelib.configDialog, inspect >>> print inspect.getsource(tkFont) >>> print inspect.getsource(idlelib.configDialog.ConfigDialog.CreatePageFontTab) > thanks, > > Harlin Seritt > hope this helps -- nirinA -- -- http://mail.python.org/mailman/listinfo/python-list
Re: tkinter: always scroll to show last line of text
"Martin Franklin" wrote: > Benjamin Rutt wrote: > > I have a tkinter 'Text' and 'Scrollbar' connected and working > > normally. When a new line of text is inserted (because I'm > > monitoring > > an output stream), I'd like the text and scrollbar to be scrolled > > to > > the bottom, so the latest line of text is always shown. How to do > > this? Thanks, > > > text.yview_pickplace("end") > or text.see('end') there is also a "ScrolledText" module >>> import ScrolledText >>> 'see' in dir(ScrolledText.ScrolledText) True -- nirinA -- same-response-again-and-again -- -- http://mail.python.org/mailman/listinfo/python-list
Re: Searching for a ComboBox for Tkinter?
"Harlin Seritt" wrote: > I've created a ghetto-ized ComboBox that should work nicely for > Tkinter > (unfortunately no dropdown capabilities yet). > how about: >>> import Tix >>> print Tix.ComboBox.__doc__ ComboBox - an Entry field with a dropdown menu. The user can select a choice by either typing in the entry subwdget or selecting from the listbox subwidget. Subwidget Class - - entry Entry arrow Button slistboxScrolledListBox tickButton cross Button : present if created with the fancy option -- nirinA -- http://mail.python.org/mailman/listinfo/python-list
Re: Install problem Windows xp HE
"Jan Ekström" wrote: > Here is the error. > IDLE 1.1 > >>> python > > Traceback (most recent call last): > File "", line 1, in -toplevel-python > NameError: name 'python' is not defined > >>> this should be a success install report! not an error. start coding and see what happens. >>> print "Hello World!" -- nirinA -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter Bitmap Newbie question
"Wim Goffin" wrote: >>> Hi, hello, >>> I'm trying to get a bitmap onto a button, but I can't. >>> Can anyone tell me where to look for a solution? >>> >>> The call I use is this one: >>> self.b = Button(toolbar, text="nieuw", bitmap="@/test.xbm", >>> width=20, command=self.print_msg) >>> >>> The message I get is this: >>> Traceback (most recent call last): >>> File "C:\Documents and Settings\Wim\Mijn >>> documenten\Python\overhoor.py", line 143, in -toplevel- >>> app = App(root) >>> File "C:\Documents and Settings\Wim\Mijn >>> documenten\Python\overhoor.py", line 71, in __init__ >>> self.b = Button(toolbar, text="nieuw", bitmap="@/test.xbm", >>> width=20, command=self.print_msg) >>> File "C:\Python24\lib\lib-tk\Tkinter.py", line 1939, in __init__ >>> Widget.__init__(self, master, 'button', cnf, kw) >>> File "C:\Python24\lib\lib-tk\Tkinter.py", line 1868, in __init__ >>> self.tk.call( >>> TclError: error reading bitmap file "\test.xbm" >>> >>> This is hapening on a WindowsXP system. >>> It seems as though the file is not found. Because if specify the >>> name of a non-existing file, >>> then I get exactly the same error. What could I do to make sure >>> first that >>> Puthon does find the file? well, you do make sure that the file exists in the right place. bitmap="@/test.xbm" means something like: look for a bitmap file named test.xbm at location "/" , that is, at the top level directory. bitmap="@c:/test.xbm" is equivalent. some solutions: 1) copy (or cut) and paste the file test.xbm to c:/ and continue to use your code or, 2) if test.xbm is in the same directory as your code, you may write: bitmap="@test.xbm" or bitmap="@./test.xbm" where "./" means the current directory or, 3) you may write something like (one single string!): bitmap="@C:/Documents and Settings\Wim/Mijn documenten\Python/test.xbm" notice also that if the bitmap appears in your button, your text="nieuw" may not be visible. >>> Thanks in advance, >>> Wim Goffin hope this help. -- nirinA -- http://mail.python.org/mailman/listinfo/python-list