988 Posted Topics
Re: Maybe this short example will help: [code=python]# reference across class instances # from one panel class to another panel class import wx import time class MyPanel1(wx.Panel): def __init__(self, parent): wx.Panel.__init__(self, parent, wx.ID_ANY, pos=(0,0), size=(300, 100)) self.SetBackgroundColour("green") self.button = wx.Button(self, label=" panel1 button ") self.button.Bind(wx.EVT_BUTTON, self.buttonClick ) def buttonClick(self, event): """ … | |
Re: To keep related things together, you might want to check into a dictionary: [code=python]# here a,3 b,2 and c,1 are related pairs q = [['c', 'b', 'a'], ['1', '2', '3']] d = dict(zip(*q)) print d # {'a': '3', 'c': '1', 'b': '2'} for key in sorted(d): print key, '-->', d[key] … | |
Re: Yes, you can use Tkinter. Here is a hopefully helpful explanation how Tkinter draws circles that follow a mouse click. The basics are there, you just have to apply them to your problem: [code=python]# draw a circle with given center (x,y) and radius at mouse click point import Tkinter as … | |
Re: [QUOTE=sneekula;698916]Don't worry about those folks, they will get a slap on the wrist at the most. Just like Neil Bush, Charles Keating and John McCain got on the Savings and Loan scandals a few years back.[/QUOTE]Remember that turd floats! | |
Re: Works great with an XP, so it could be Vista that srews things up. [code=python]# send text to the clipboard import win32clipboard def txtToClipboard(iTxt): win32clipboard.OpenClipboard(0) win32clipboard.EmptyClipboard() win32clipboard.SetClipboardText(iTxt) win32clipboard.CloseClipboard txtToClipboard('text to paste') # test # or use paste in the editor window data = win32clipboard.GetClipboardData() print data [/code] | |
Re: If we call folks from Mexico Mexicans and folks from Canada Canadians, what do we call the folks that live in the good old USA? Also, America refers to North, Central and South America. | |
Re: This would be a typical Tkinter class creating what looks like a traffic light. I leave it up to you to assign the proper light actions. [code=python]# a simple Tkinter class import Tkinter as tk class TrafficLight(tk.Frame): """inherits tk.Frame""" def __init__(self, parent=None): tk.Frame.__init__(self, parent, bg='green') self.grid() # create a canvas … | |
Re: Congratulations Grim and Henri, a fantastic accomplishment only a few posters have achieved! No wine for me, just a couple of microbrews. | |
Re: I think Ike should have snowed itself out of existence near the North Pole by now, giving Santa some much needed white fluff. | |
Re: I really enjoy Python, take a look at: [url]http://bembry.org/technology/python/StartProgramming.pdf[/url] and: [url]http://www.daniweb.com/forums/thread20774.html[/url] The whole Python package is open source and free from Python.org. If you decide to get Python, download the Windows installer package (.msi) of version 2.5 or 2.6. Stay away from version 3.0 since it will make a few … | |
Re: [QUOTE=corrola;701901]Do I need a college degree to be considered?[/QUOTE]It most certainly will help! | |
Re: Nice game! Just a few cosmetic things, there is a lot of empty space, so I would set the height of the frame to 180, and also use a little color with: bkg.SetBackgroundColour('yellow') | |
Re: I think the wholesale fraud comes after you elected an official and he/she gets exposed to a hall full of lobbyists. | |
Re: With the millions and millions of books published, one should not be surprised that every now and then one finds one book, where the author was a few bricks shy of a load. Coming back to the subject of this thread: Dark energy and dark matter surely is a hoax … | |
Re: Why do all the extra work, if Python can do it for you? [code=python]result3=[ 83,97,109,117,101,108,32,83,109,105,116,104,13,10,13,10,84, 104,97,110,107,32,121,111,117,32,102,111,114,32,108,111,111, 107,105,110,103,32,116,104,101,32,111,116,104,101,114,32,119, 97,121,32,111,110,32,116,104,101,32,105,110,99,114,101,97,115, 101,100,32,108,101,118,101,108,115,32,111,102,32,116,111,120, 105,99,32,99,104,101,109,105,99,97,108,115,32,105,110,32,116,104, 101,32,114,105,118,101,114,32,114,117,110,110,105,110,103,32,97, 108,111,110,103,115,105,100,101,32,109,121,32,104,111,109,101] # show the text hidden in the list of ascii values print "".join([chr(x) for x in result3]) [/code]I know, I know, not as much fun as the long … | |
Re: if you open the file with "r" you get: 'str' object does not support item assignment if you open the file with "rb" you get: Insecure string pickle Somehow the new.txt file must be corrupted or used a strange dump() protocol. | |
Re: [QUOTE=ZZucker;698706]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.[/QUOTE]Hey Zoe, let me know if you get the stuff! I would be happy with just 1% (7 Billion Dollars) of the … | |
Re: For the many of you who still want to know the solution, make variable 'a' a global: [code=python]words = ["aero", "aesthet", "andr", "arch", "arch", "ast", "baro",\ "biblio", "bio", "cardi", "chron", "cosm", "crat", "cycl", "dem", "dont",\ "dogma", "dox", "esth"] answers = ["air", "sense", "man", "man", "chief", "ancient", "star", "weight",\ "book", "life", … | |
Re: I wonder if all those annoying Cirtcuit City popups on DaniWeb are considered spamming? | |
Re: Jerome Allen "Jerry" Seinfeld is funny, Bill Gates is the opposite. The result is big fat ZERO. | |
Re: [QUOTE=ZZucker;527660]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.[/QUOTE]That movie kind of blows your mind! Brings up the thought that the … | |
Re: Wonderful organization, they have answered my prayers many times! | |
Only for experts: [url]http://www.funnyjunk.com/movies/1498/Kissing+Prank/[/url] | |
Re: There are quite a few US military advisers in this Georgia country trying to rearm Georgia to NATO standards. Maybe the Russians want to get get even with the Georgians for sending them the one thing that has killed more Russians than aything else --> Joseph Stalin! I find it … | |
Re: Chinese Translations (if you are Chinese don't read this): Has your flight been delayed? - Hao Long Wei Ting? I got this for free - Ai No Pei I bumped into a coffee table - Ai Bang Mai Ni Please, stay a while longer - Wai Go Nao? They have … | |
Re: [QUOTE=evstevemd;686076]Just to add on that, I want to put my icons in a folder named icons in the same folder as my script. How do I reference them in code without error "File so and so.png does not exist" Thanks again[/QUOTE]On Windows you do a "./icons/myicon.ico" for example. | |
Just got a PM on DaniWeb with this sender: From Miss Patricia Dick Abidjan,Cote D'Ivoire The rest is a typical Nigerian financial scam! Did anybody else get this? The user name was blessing12 | |
Re: Since you know Python's syntax, get to know the modules and what they do. Also, get involved with a project you want to accomplish. For some beginner's project ideas look at: [url]http://www.daniweb.com/forums/thread32007.html[/url] | |
Re: You might better use a low level system language like C or C++ | |
Re: I ran your code and it took over my computer. It took me forever to get it back to normal again. There is something wrong with your application of sendkeys or pyhook! To tell you the truth, I won't even try to figure it out. | |
Re: PyGame isn't very useful as a typical GUI toolkit, but if you want to have fun with images, animation, sound, video etc. it is great. Like the name says, it's a good toolkit for game development with Python. Here is a typical example for drawing shapes: [code=python]# draw random circles … | |
Re: [QUOTE=PalomoBlanco;677443]I've got the "antivirus vista 2009" (worm or virus, I don't know), it did his thing and immediately offer to clean my computer for 90 dollars, that's why I got mad, they mess your computer and then try to steal your money!! People who does not know how to fix … | |
Re: Ah, "poodly", meaning act like a well trained poodle, a new word for the dictionary. JB, how is your former main poodle, forgot his name, doing these days? Strange, when I look at dogs I think of poodle being French, terrier being English, and dachshund being German. | |
![]() | Re: There was a suggestion of using PortablePython on a stick (USB Flash Drive), would that work? |
Just noticed that I passed the ever so sweet 1000 postings mark! Isn't DaniWeb great! | |
Re: Also ballSpeed = [0,4] means move the ball 0 pixels along the x axis and 4 pixels along the y axis. Pixels have to be integers. When you set it to [0,0] it stops of course. | |
Re: That is the way geography is taught in our public schools. I think it is also the map that hangs in Dick Chainey's basement office. | |
![]() | Re: My advice for you is to study up on the very basics of Python. Your code is simply loaded with too many rudimentary mistakes! |
Re: [QUOTE=bumsfeld;670757]It takes government by the people for the people, not government by lobbyist for lobbyists.[/QUOTE]Let's all become lobbyists, then we are back to normal. | |
Re: I think the new Pope is quite hip! Let's support the poor fellow with your tax deductible donation! | |
Re: [QUOTE=Aia;662168]Main purpose is to learn how to better tailor targeted ads to you and yours. Now the possibilities for other uses are limitless, or I should say; limited only by their imagination. I leave to you to speculate who "they" are.[/QUOTE]Could be George Bush's "National Spy Agency" run by the … |
The End.