407 Posted Topics
Re: jbennet, you are simply exceptional! Remember half the people you know are below average. | |
Just an accumulation of funny news lines: Governor Chiles Offers Rare Opportunity To Goose Hunters (The Tallahassee Democrat) Gators To Face Seminoles With Peters Out (The Tallahassee Bugle) Messiah Climaxes In Chorus Of Hallelujahs (The Anchorage, Alaska Times) Textron Inc. Makes Offer To Screw Company Stockholders (The Miami Herald) Something … | |
Here is your chance to ask a 'smart' question in an attempt to have one of those real smart DaniWeb Geek members answer it. If the question just makes you think or smile, that is good enough too! Please no computer questions. :) Okay, to start out: Why does a … | |
Re: I haven't had too many problems with wxPython programs on Vista, but the OS has screwed me up in many other ways. Whenever I can I use an older XP machine. Maybe you can relax the super childish default security scheme they use to a lower level? | |
Re: If you reprogram her, it wll last a day. If you teach her how to program, ........ (she will reprogram you) | |
Re: Yeah, the credit card, a necessary evil, always use it, but also always pay it up in time. I have plenty of foolish friends who spend half their income on cedit card interest. Some of those cards make a loan shark look friendly! Also remember that Joe Biden was behind … | |
Picked from newspaper classifieds: '83 Toyota hunchback -- $2000 Just in time for deer season: 2 wire mesh butchering gloves, one 5-finger, one 3-finger, pair only $15 Bill's septic cleaning "We haul American made products" Our sofa seats the whole mob and is made of 100% Italian leather. Joining nudist … | |
![]() | Re: Sometimes a test print will help you visualize what is going on: [code=python]def insertion_sort(qq): for j in range(1, len(qq)): key = qq[j] i = j - 1 while (i >=0) and (qq[i] > key): qq[i+1] = qq[i] i = i - 1 qq[i+1] = key # test print ... print … |
Re: One more way for the fun of it: [code=python]import random let = [ 'a', 'b', 'c', 'd', 'e', 'f', 'g' ] random.shuffle(let) while len(let): print let.pop() [/code] | |
Re: You can use the module inspect: [code=python]import inspect class C1(object): def __init__(self): print "C1" def f1(self): print "f1" pass def f2(self): print "f2" pass inst1 = C1() try: print inspect.ismethod(inst1.f1) # True print inspect.ismethod(inst1.f2) # True print inspect.ismethod(inst1.f3) # 'C1' object has no attribute 'f3' except AttributeError, error: print error … | |
Re: Here is another way you can skin it: [code=python]def sum_cube(n, sum=0): if n > 0: x = n**3 return sum_cube(n-1, sum+x) else: return sum print sum_cube(5) # 225 [/code] | |
Re: [QUOTE]Choose to think for yourself rather than letting someone else do it for you. [/QUOTE]That does not sound very devout and pious. | |
Re: [QUOTE=HiHe;716878]Hehe, my English is good? I hope you mean capitalization. Just smile, you could be the British Bush, "bushing" the proper language. Just "funnen" you! :)[/QUOTE]Take it easy HiHe. When you are as cute as young jbennet, than any "bushin" of the English language can be forgiven! | |
Re: This should eventually work: [code=python]class MainFrame(wx.Frame): def __init__(self): wx.Frame.__init__(self, None, title = 'Sentence Generator', pos = (200, 75), size = (WINDOW_WIDTH, WINDOW_HEIGHT)) self.background = wx.Panel(self) self.makeBtn = wx.Button(self.background, label = 'Make') self.makeBtn.Bind(wx.EVT_BUTTON, self.displaySentence) self.resultBox = wx.TextCtrl(self.background, style = wx.TE_READONLY | wx.TE_MULTILINE) self.hBox = wx.BoxSizer() self.hBox.Add(self.resultBox, proportion = 1, border = … | |
Re: Yeah vega, VPython is an interesting module for 3D modeling (free too). I played around with it and came up with this: [code=python]import visual as vs vs.scene.width = 500 vs.scene.height = 500 vs.scene.title = "draw a cone on a ring (drag with right mouse button)" # avoid autoscale (autoscale default=True) … | |
Re: Here is an example of re module's sub(): [code=python]import re # replace all ;,. characters with _ p = re.compile(r'[;,.]') s = 'hi;your,face.is;on,fire' print p.sub('_', s) # hi_your_face_is_on_fire [/code]or: [code=python]import re s = 'abc123' p = re.compile("[a-z A-Z]") # subbing with an empty string "" amounts to strip print p.sub("", … | |
Re: [QUOTE=bumsfeld;714948]Don't go to just any church, go to Catholic Church![/QUOTE]I agree! My church has helped me many times when I was down. | |
Re: There are tricky computer languages and there are nice ones. Which one are you taking? | |
Re: Canada has no president. Canada's government is a Parliamentary democracy (federal constitutional monarchy) whose Monarch is Queen Elizabeth II. Canada has a Prime Minister. | |
Re: In your code [B]source[/B] is not a list or tuple. You can use a helper [B]print source [/B]to look at it. | |
Re: Give this a try and see if it works: import subprocess subprocess.call(['posidbfw', '/alt', '1', '1']) | |
Re: I think you want module curses, that one has setsyx(y, x) that puts the cursor to where you want to print on the screen. Check: [url]http://docs.python.org/lib/curses-functions.html[/url] | |
Re: [QUOTE=Aia;702917]Regex it is just that, [URL="http://www.regular-expressions.info/tutorial.html"]regular expression[/URL]. A pattern describing some text.[/QUOTE]Yes we know! How about learning some Python first before giving primitive lectures. We are trying to help people and keep a friendly atmosphere here! BTW, if you need help with the module re, simply type help(re). Or go … | |
Re: A class should only group functions together that belong together. I would also avoid globals, they are devils as your program grows. A class handles globals within the class using self. | |
Re: If you look into Main.py, you find: [code=python]def opj(path): """Convert paths to the platform-specific separator""" st = apply(os.path.join, tuple(path.split('/'))) # HACK: on Linux, a leading / gets lost... if path.startswith('/'): st = '/' + st return st [/code]The problem is that the 'wx code demo stuff' is unnecessarily complex on … | |
Re: On first blush, you need to create your wordlist outside the loop, or you will keep appending to it all the time: [code=python]#decode scrambled word from a word list in 30 sec or less. matches = [] thelist = [] myvar = -1 c = -1 p = -1 wordlistfile … | |
Re: 700 Billion Dollars with no strings attached. More giant taxbreaks. Easier ways to send my loot to the Caymen Island Banks. Politicians that give discounts to frequent influence buyers. | |
Re: "For the things we have to learn before we can do them, we learn by doing them." | |
Re: [QUOTE=Mr_Grieves;695650]Aha -- I just needed to rtfm a bit more clearly. In the fine print on [URL="http://docs.python.org/lib/typesseq-strings.html"]http://docs.python.org/lib/typesseq-strings.html[/URL], it says the alternate form (with the # flag) gives this behavior, so: [code] >>> print "%#.4g" % 6.340024e-34 6.340e-34 [/code] I've been looking for this solution for so long, I'm beside myself … | |
Re: I have watched Star Trek "The Motion Picture" a few times. There the living thing is the spaceship itself, hard to miss since it is about the size of Texas. Interesting concept. Something like this might be possible. | |
Re: GrimJack, I am impressed. You are unquestionably the smartest person on this forum! | |
Re: Just imagine, someday I might be able to write such an important memo to my underlings, I mean associates, I mean partners, I mean coworkers, I mean colleagues, I mean friends, ... | |
Re: Too bad the next Olympic games are not in Russia, or we could boycott that again! Maybe we should move the next games to Gruzya. | |
Re: What a poor example of Python, violates all the Zen! There is an outcry for loops and functions. [code=python]import this [/code] | |
Re: You may want to use a Device Context widget like the one used in: [url]http://www.daniweb.com/forums/showpost.php?p=688718&postcount=74[/url] | |
Re: The terminator and the chipmunk are at the same intellectual level. | |
Re: So, why is China listed as number one when the USA has by far the most medals? | |
Re: [QUOTE=The Dude;672088]If this is real i feel bad for her!! [url]http://www.drudge.com/news/111229/most-pathetic-obituary-ever[/url][/QUOTE]Well, it didn't exactly say where she would be in her afterlife. Maybe her husband and son were involved in politics! | |
Re: [QUOTE=paulthom12345;676092]Hi I have made a program that uses a GUI for most of its functions but as soon as i change it to an exe using py2exe all the buttons turn all square and everythin looks like it came from windows 98 rather than XP. Is there any way to … | |
Re: [QUOTE]Cook your hamburger all the way through. No runny eggs. Wash your vegetables. Peel your fruit.[/QUOTE]In all those cases it's bacteria, poor sanitary practices, not poisons the corporation put in there! | |
Re: Looks like the USA is beating all the other countries easily again! We need something to make us feel good! |
The End.