614 Posted Topics
Re: [QUOTE]Dutch artist Job Koelewijn sure knows how to make an awesome bookcase. Behold his lemniscate bookshelf that represents the infinite power of books and learnin’ [url]http://www.topnewsblog.info/tblog_11136.htm[/url] [/QUOTE] But how would you get to the books on the inside?!? | |
Re: Just an idea but in the regular expression you look for a string that goes "group:" with a colon while in the text file you have it like "group=" so that could be screwing it up. | |
Re: There is a great module called winsound. [code=python] import winsound winsound.PlaySound("soundFile.wav",SND_ASYNC) raw_input() [/code] Just make sure to change the name of the file. FOr more reference check out this page: [url]http://python.active-venture.com/lib/module-winsound.html[/url] | |
Re: Okay, firstly, what are you talking about? Are you using Notepad to save your python files and that is stuffing up? Are you using IDLE and that wont save? Have you got a save box in your program that stuffs it up? Please provide more information, otherwise its hard to … | |
Re: This worked for me: [code=python] import wx import wx.media import os class Events(): def __init__(self,player): self.player = player def pauseFile(self,event): self.player.Pause() class MainFrame(wx.Frame): def __init__(self): wx.Frame.__init__(self,None,title = "Media Player") self.panel = wx.Panel(self) self.player = wx.media.MediaCtrl(self.panel) self.functions = Events(self.player) self.load = wx.Button(self.panel,wx.ID_ANY,"Load File") self.load.Bind(wx.EVT_BUTTON,self.loadFile) self.play = wx.Button(self.panel,wx.ID_ANY,"Play") self.play.Bind(wx.EVT_LEFT_DOWN,self.playFile) self.pause = wx.Button(self.panel,wx.ID_ANY,"Pause") … | |
Hi I have been using classes for quite a while but there is still one concept yet that i havent ever quite understood and that is decorators. I have noticed Gribouillis uses them a lot so in some ways this question is directed at him. I would like to know … | |
Re: I used a function and that cut down on code needed: [code=python] # Character Development Dungeons and Dragons # pool are the total points that I can use. pool = 30 strength = 0 health = 0 wisdom = 0 dexterity = 0 choice = None def getInt(prompt, maximum, cur): … | |
Well, Christmas eve and right now is where you find lots of TV shows trying to get into the festive season by doing a Christmas Special. Now some of these can be good... but some, just are not meant to even be christmas specials. I thought it would be good … | |
Re: There are lots of python HTML modules out there and places that teach you loads about HTML with python: [url]http://www.boddie.org.uk/python/HTML.html[/url] [url]http://www.hoboes.com/Mimsy/?ART=128[/url] [url]wiki.python.org/moin/WebProgramming[/url] | |
Re: Yes, for all versions 2.x-2.6 . Now that is not true when going from python 3.0 down to something like python 2.5 or 2.6 because python 3.0 is structured completley differently to python 2.5 or others. There is no raw_input() there is no print. | |
Re: Ah good old SendKeys. I have written whole programs using this. Its a really great module to use. It is really simple but it has one pitfall in my mind. That is that every time that you use it NumLock is disabled. I know that dosent affect some people because … | |
Re: Try open Ctrl+Alt+Del and going to the processes tab. Then look for any processes called "python.exe" or "pythonw.exe" then end all of those. If you have any python windows open they will shut so close everything beforehand. Then once all processes called "python.exe" or "pythonw.exe" have ended it should work. … | |
Re: Could you post the code and perhaps a bit more detail of your problem. What is the input and output at the moment and stuff like that. | |
Re: Normally when you open a file though it will re-write the file, that is if you open it in write mode. So make sure, if you dont want anything wiped that you can either load the file into a string or something, change what you want and then re-write it … | |
Re: You could also go: [code=python] import random w1 = ["abacus", "biology", "chemistry", "dog", "elf", "ghost"] for f in range(len(w1)): w = random.choice(w1) w1.remove(w) print w [/code] | |
Hi, Im making a program that is sortove like a media player... well, it is a media player. Its quite basic at the moment but i have been working on a few features. One of the things it can do is that it can play a video full screen. I … | |
Re: Just wonding, i know a lot of people here will probably not have heard of Panda3D. Me included. Personally i would reccommend talking to the people at the site. Here is a place that has forums that deal with Panda3D, they may be able to offer more help: [url]http://panda3d.org/phpbb2/index.php[/url] | |
Re: Ah, your problem is the following. You have put in your raw_input() to open the file e:. The problem with that is that you are asking it to open a full directory, not just a file. I had this same problem instead with writing files. You need to specify an … | |
Re: Where can we download all of the bitmaps for the buttons for it? | |
Re: Just a word of advice about your if in your code. That is statement will almost always execute unless start is equal to zero. The reason is, even though saying OR something else. You cant apply the same operator to each. So you would have to go: [code=python] if start … | |
Re: We wont be able to help you unless you also provide the code for theGraph. Otherwise we are just guessing. | |
Re: I got this problem once. I fixed it my (in windows XP) by opening the task manager and ending any processes of python. I found that some of my previous programs, usually the wxPython ones, were excellent at leaving behind processes especially if they didnt end properly. I find that … | |
Re: Well there are a few ways to do it. Preferably i would use a dictionary but as we cant here is another way: [code=python] import string number = raw_input("Please enter the number:").lower() n_list = list(number) for enu,f in enumerate(number): if f in string.ascii_lowercase: i = string.ascii_lowercase.index(f)+2 i /= 3 if … | |
Hi guys, I was making a program yesterday that would send an email using the email modules of python as well as the smtp module. My problem is when i put it into an exe using py2exe and vega's code snippet setup i get some problems. This is the error … | |
Hi guys, I have a program that lets the user play a sound but i was wanting to know how i could make it so the user could vary the speed in which the sound plays so the sound can play slowly and quickly and normaly as well. Is this … | |
Re: Could you test how many pixels are red? Because a circle will require many more pixels to draw then a line. I know when getting colours i used something like: [code=python] import Image im = image.open("myPic.jpg") for pixel in im.getdata(): #check if it is red [/code] | |
Hi Guys, My setup is as follows, i have a D-Link DI-524 router and four computers. Three of them have windows XP Professional while the other computer has windows XP Home edition. They are all connected to the router. The ones with winows Professional are all wireless while the one … | |
Re: Also note that wxPython has some issues on the mac so be careful. | |
Re: if you want to print a variable in the middle of a print statement there are two ways to do it. [code=python] grade = 0 print "Final grade is",grade,"out of 100" [/code] OR [code=python] grade = 0 print "Final grade is %i out of 100" %grade [/code] Hope that helps. | |
Hi guys I am making a program that uses a text control to move messages from one place to another. My program needs to be able to, once the message has been moved, delete what is in the textCtrl. I can go: [code=python] self.textCtrl.SetValue('') [/code] but that leaves me with … | |
Re: Well python only does one thing at a time so perhaps while the images are being done it dosent do the GUI. A way around this is to use the thread module. Threading is useful if you want two things to be able to happen at once. | |
Re: You could use list comprehension as well [code=python] binary = raw_input() if False in [f == '0' or f == '1' for f in binary]: print "Not Binary" else: print "Is Binary" [/code] | |
Re: I think you could also use XML to save it. If you are using wxPython then there is an XML module you can load that makes it nice and easy to load. The module is wx.xrc, it can load a panel, a frame or any other kind of object. Its … | |
Re: It is used with events in wxPython. If you have a button lets say that when you press it pops up a dialog box. But there is also something else going on and you want the method that makes that dialog box to be called After the event function is … | |
Re: This is not very hard if you use the random module. [code=python] import random words = ['hello','python','monday','tuesday','friday','ice'] choice = random.choice(words) print "Guess the word!" guess = raw_input() while guess.lower() != choice: print "sorry, not correct" guess = raw_input() print "well dont that was it!" [/code] | |
Re: you use a range. [code=python] for variable in range(n/2): #do stuff [/code] | |
Re: just quickly i wanted to remind Darkangel or the NCSS Challenge rules. Rule 3 stated that: "The solutions you submit must be your own. It is fine to discuss the problems, and to read code in books or on web sites to get ideas, but you must be the author … | |
Re: Could we have an example of what stock.txt has in it please? | |
Yesterday, i was programming a program in Java when i came accross something i though was just amazing. I could read and write complete Obects with just one line of code! They would go to a file and when i loaded then they would be straight back, without me having … | |
Re: If you want to do that to an int and you just want to add it on the end then you could go: [code=python] >>> adam = 123 >>> john = 456 >>> #if you just add them together they don't add on to the end, >>> print adam+john 579 … | |
Re: Python would be easy to do this in. You could use a mixture of the random module as well as the String module and combining them together to get something that does it for you. In fact i will show you how i would do it if i was making … | |
Re: Just take the comma off the end of line 20. Adding the comma makes it a tuple. | |
Re: I find functions still a great thing to have if you want to have something unrelated to either class. Personally i like to only have related functions in a class and if i want a function and there is no specific class that it fits into then i do not … | |
Re: you can also use eval or exec on the text file if it was like this: [quote] t = 1 variable2 = 10 string = 'hello' [/quote] if you had this in your program [code=python] f = open('variables.txt') for line in f: eval(line) #or exec(line) [/code] That will then set … | |
Re: Your problem is that sys.argv is what you supply on the command line after starting the script. So you would go [code=python] python mycode.py arg1 arg2 [/code] For yours to work you need at least 2 arguments for there to be sys.argv[1] | |
Re: You have a lot of errors your code. First of all let me say that you can really only use self when you are in a class. A lot of your code in your program should be in the __init__ method. Also in you Add method you have return x … | |
Re: So you want the user to be able to specify which class to use? Well a way to do that would be to split the string and do some if statements such as: [code=python] i = raw_input() if i.split()[0] == 'add': p = add(i) p.hi [/code] If thats not it … | |
Re: Can you please give us examples of numbers which stuff up the program and the FULL error statement because that will help even more. Also tell us wether you are doing a withdrawal, deposit or something else at that time. Oh and please wrap your code in code tags. I … | |
Re: Ah i have had this problem before. I found it really really useful to use Threading. So maybe you could make a function or class that uses Threading and then you can have it wait for user input while the rest of the program goes its own way. |
The End.