244 Posted Topics
Re: I'm up for contributing. My experience is mainly Python, but also PHP (+ HTML/CSS/Javascript; you said it was for browsers?) and also Actionscript 2.0 and 3.0, and a tad of C++, but that last one doesn't matter for web stuff. Also, money doesn't bother me - I program for fun | |
Re: I can't help with GUI stuff as I can't use Tkinter, only wxPython. However, if you decided to use [I]os[/I] system calls, you can always use threading to run the os calls in one thread, and use a second to update your GUI. Or like Bumsfeld said, you could go … | |
Re: [QUOTE=serkan sendur;927683]but they have something in common...[/QUOTE] Possibly some deeply-rooted Celtic hatred of the Saxons :P And moving out isn't just that easy. I work two jobs but still live at home... | |
Re: I don't use Tkinter as I personally hate it :P But I'm going to assume that the [I]Text[/I] control has a [I]write[/I] function of some kind, just like the wxPython [I]TextCtrl[/I]s. If that's the case, then you redirect the standard output stream so that it uses your Text control as … | |
Re: [QUOTE=zachabesh;926136]Ewwww. Half your variables aren't even defined dude. You can't say: [CODE]def SplashScreen(self): root.title("My Title")[/CODE] What is root? When do you define root?[/QUOTE] If you scrolled to the bottom of the code, after the class definition, you'd see that he defined [I]root[/I] as [I]Tk()[/I] :P | |
Re: I have the same issue. When running a wxPython program from the .py file, it uses the Windows XP Luna theme on the widgets. However, when I compile it to an .exe with py2exe, it defaults to the classic theme on the widgets (win 2000, 98, etc). I couldn't find … | |
Re: [QUOTE=vegaseat;912274]Maybe I ought to wait till the Google Chrome OS comes out a year later. That one is supposed to be safe from virus attack.[/QUOTE] Ah, but I don't trust Google with my whole OS :P They already know enough about me... (my paranoia is kicking in) And it'll just … | |
Re: Hello, I look forward to seeing you around :) And as a side note, I'd personally suggest sticking with Python 2.5 or 2.6 for another little while, just because so many third-party modules and such aren't supporting 3.x yet. (Among those important to me is wxPython, an excellent GUI toolkit … | |
Re: You can try substituting your current thread with this custom Thread class which allows only itself to be killed. [code=python] import threading, sys, trace class KThread( threading.Thread ): def __init__( self, category, desc, func, params=() ): threading.Thread.__init__( self ) self.category = category self.desc = desc self.function = func self.params = … | |
Re: And by the way, you can copy from the Ubuntu terminal via [I]Ctrl+Shift+C[/I], and past into it with [I]Ctrl+Shift+V[/I]. Now you can give us a full traceback, plus you should also provide the code segment which the error is in, and any other info we need to know pertaining to … | |
Re: Yeah, the "\x##" is the format for encoding non-ansi (is that correct?...) characters. As far as I can tell, these are useless characters anyway, because if you pick through the segment: [icode]'\x00A\x00D\x00A\x00M\x00S\x00 \x00C\x00O\x00U\x00N\x00T\x00Y\x00'[/icode] You can see that there are the regular letters "ADAMS COUNTY" in it. So are all these … | |
Re: [QUOTE=serkan sendur;925279]That is why i respect a blonde cute female c++ developer too much. She could have taken advantage of her beauty instead of ... <snip>[/QUOTE] Let's please not let this thread steer in the creepy direction too. That whole post was completely unnecessary and I really didn't need to … | |
Re: Do you mean you want to format your output automatically in Python, i.e. wrapping it in appropriate HTML tags? Or just do you mean save whatever comes out of your program into a file with a .html extension? For appending to a file, just open it with append mode, i.e. … | |
Re: You're going to want to read up on what objects are; the whole [URL="http://en.wikipedia.org/wiki/Object-oriented_programming"]OOP[/URL] thing. You'd be doing something like: [code=python] class Room(object): def __init__(self, description): self.desc = description def showDesc(self): print self.desc myroom = Room('You are standing in a restroom...') otherroom = Room("You are out in a dark hallway...') … | |
Re: You were on the right track. Find the 'del' part, then include backwards until you encounter an underscore; this allows for if the number was single, double, triple, quadruple, etc digits long. [code=python] filename = '/grups.google.com/grup/cmp.lng.pythn/browse_thread/thread/8_ee63e_17del_0c12d' end = filename.find('del') # reverse-find the first underscore in the filename # from the … | |
Re: Are you talking about having your own host for this or some sort of community-based site? | |
Re: Yes, but are you going to make the user open the second program when they run the game? You can't open a new console window through your main Python script. | |
Re: Keep the gold amount as a list: [code=python] def goldKeeper(x): a = 200 # if 'x' contains any indices if x: if x[-1] <= a: # store new 'x' value x.append(a) elif x[-1] >= a: print a + x, # if 'x' is a blank list else: print a+x, gold … | |
Re: What does your main [I]package[/I] __init__ file look like? It could be that you're doing something like [icode]from subpackage1 import *[/icode], in which case, the module [I]subpackage1[/I] wouldn't actually be defined. You'd just be dumping everything from its namespace into the main one. Of course, this is just my guess … | |
Re: [QUOTE=jephthah;920148]... Super Moderator badge? can i have it?[/QUOTE] You have my vote. I believe the forums would be filled with a lot less of the "i has homework give me code plz" posts. | |
Re: re.split breaks the string in the specified pattern, removing the parts which caused the split. There is a much simpler solution to this problem though. Just iterate the string by splitting it at each space and compare each word to a list of words you're watching for. You don't need … | |
Re: Well the simplest solution is just to use the style flag wx.TE_PASSWORD when you create the TextCtrl for the password. That automatically makes the output asterisks. | |
Re: Well your code confuses me. The first instance of [I]j[/I] is in a conditional statement comparing it to the number 7. I don't see it even initialized before that. And the same goes for [I]a[/I]. Oh, and [I]Iteration[/I] - what's the value of that? Maybe post code explaining what those … | |
Re: Wow. He had to tase a pig? What a man... I guess they'll be needing those tasers for the estimated 100,000 Burmese Pythons that are on the loose in Florida though. | |
Re: I get this error if I run a wxPython program more than one time from within IDLE. For some reason, IDLE buggers it up, which is why I don't develop with it. If you close IDLE and re-open your script and run it once, it should work the first time, … | |
Re: jice is right. You're telling it to start at 0 and end at 13, but your step is -1, so it won't work. I think you're a little confused; the [I]-1[/I] does not 'reverse' the operation. It sets the amount it steps by each time... So if I set it … ![]() | |
Re: Can you please post a smart question? You included no details about this "python application output" or anything about your program as it is. Then maybe I'll help. | |
Re: Like zachabesh said, you should take a look at the [I][URL="http://docs.python.org/library/shutil.html"]shutil[/URL][/I] module for more file operation functions. And [URL="http://docs.python.org/library/shutil.html#shutil.copytree"]copytree[/URL] may be of particular interest to you too :P | |
Re: You can execute it using the [I]os[/I] module. In DOS or GNU/Linux, in the command line you can type [icode]python code.py[/icode] to execute a file. So you can try this: [code=python] import os os.system("python othercode.py") [/code] The one problem would be if the user does not have "python" registered as … | |
Re: All I could for SVG support for wxPython is [URL="http://code.google.com/p/wxpsvg/"]wxpsvg[/URL]. They don't have any built downloads so you'd need to grab the source from the trunk and build it yourself. Here's where you can browse the source: [URL="http://wxpsvg.googlecode.com/svn/trunk/"]http://wxpsvg.googlecode.com/svn/trunk/[/URL] Hope it helps! [B]EDIT:[/B] The source in the [I]svg[/I] folder looks incomplete, … | |
Re: First, you should change the line where you bind the button to: [icode]button.Bind(wx.EVT_BUTTON, self.onClick)[/icode] or else give the button an id (it's the arg passed second in the button's constructor) and then you can use [icode]self.Bind(wx.EVT_BUTTON, self.onClick, id=BTN_ID)[/icode]. The way you're currently doing it, any button's press will call the … | |
Re: And as a note, you can get rid of all the extra [I]event.type == pygame.KEYDOWN[/I] by using that as one conditional and sticking everything else under it; something like this: [code] if event.type == pygame.KEYDOWN: if event.key == pygame.ESCAPE: os._exit(1) if event.key == pygame.K_LEFT: slide -= 1 # ETC [/code] | |
Re: Python is my favourite programming language that I've learned [I]by far[/I]. They all have pros and cons of course, which means some are better suited to projects than others. Python has a simple syntax and is easy to get into, but slower to execute as it's highly interpreted. Whereas C … | |
![]() | Re: Try looking into [URL="http://en.wikipedia.org/wiki/Windows_service"]MS Windows' services[/URL]. You could set your program as a service and then have it run automatically on start-up. You may need to look into running Python scripts as services; here's an [URL="http://en.wikipedia.org/wiki/Windows_service"]example[/URL]. |
Re: If the variable userinput is waiting for the user to press a key (like Heftiger implied), then you'd need to use threading in order to process waiting for a keystroke and running a continuous loop side-by-side. That being said, yes, you can use conditional testing each time the loop runs, … | |
Re: I'll definitely check it out. Maybe just as a virtual installation with VirtualBox or something, but I'm still curious what it's got to offer. | |
Re: You'll need to use threading to handle this. One thread calls the function which does the subprocess, and the other calls a function which updates the GUI. Something along the lines of: [code=python] # untested! import thread from time import sleep def myFunc(): while True: print 'Hello world!' sleep(1) def … | |
Re: Sir, why are you running? Why are you running? Are you doing this for world peace? Are you doing this for women's right? Or for the environment? Or for animals? Or for nuclear arms? They just couldn't believe that somebody would do all that running for no particular reason. Why … | |
Re: What specifically can you not get to work about them? If you're just confused in general about how they work, try reading up on the documentation and examples through Google. Here's [URL="http://www.java2s.com/Tutorial/Python/0380__wxPython/Miniframe.htm"]a quick example[/URL], and the [URL="http://www.wxpython.org/docs/api/wx.MiniFrame-class.html"]API documentation[/URL]. If this isn't it, can you better specify what your exact problem … | |
Re: Baki is right. Iterate the lines and split them at the equals sign (but strip it properly!), then take the latter index (the right side of the sign). Strip off the leading and trailing whitespace (of each index), and voila. Here's if you wanted to make sure that the left-side … | |
Re: Why does your main function accept the keyword [icode]void[/icode] as an argument? EDIT: Wow I'm retarded. Please excuse this. | |
Re: MinGW is what I use so that I can use GCC's G++ on Windows. | |
Re: Well, that's a nice statement in your post. I see no question in there whatsoever! So obviously you don't have a problem. It was awful nice of you to tell us what you need, although I don't think anyone here has any interest in pumping out code for you or … | |
Re: In the code block where the movement of the player gets updated and applied, just run a simple check through it for something like this: Get the position that the player [I]would[/I] be at based on the movement they just pressed a key for, and then, if it's allowable, move … | |
Re: Just read the file as-is and then write the output with the lines that aren't blank. Here's an example: [code=python] # Read lines as a list fh = open("myfile", "r") lines = fh.readlines() fh.close() # Weed out blank lines with filter lines = filter(lambda x: not x.isspace(), lines) # Write … | |
Re: You need to use the 'self' keyword. So inside the function variable, you'd say [icode]self.f = 5[/icode]. Then when you call printf, you'd say [icode]print(self.f)[/icode]. By not making the variable a property of the class by using 'self', you're just making it in the local scope of the function. And, … | |
Re: So... what have you tried so far? You need to [URL="http://www.daniweb.com/forums/announcement8-2.html"]show effort[/URL] as we're not some sort of request forum that just whips up all the code for you. Post what code you have so far, specifics of what you need help with, etc. [i]Then[/i] I'll consider helping you. | |
Re: Well if you're using Python 2.x there's the [icode]exec[/icode] expression. I don't know if it still exists in Python 3.0, and I wouldn't normally use it, but it's all I can think of in this case. All you have to do is provide a string that's valid Python and it'll … | |
Re: Here's an example of how to get the current date and time (as a string) using the datetime module. [code=python] import datetime timestamp = str(datetime.datetime.now()) """result -> '2009-07-08 01:16:25.968000' """ [/code] Hope that helps! | |
Re: I personally think (as a side note), that he should: [B]a)[/B] Use a relative path so that he can keep the project in one folder and use a hierarchy of folders within that. This allows him to move the project's folder but keep all the paths in the script valid … |
The End.