614 Posted Topics

Member Avatar for pymatio

Try noughts and crosses, that a pretty easy one.. Until you try and add an AI :P Try and make your AI as good as possible without making it impossible to win!

Member Avatar for Clueless86
0
161
Member Avatar for vegaseat

I thought this might interest people, i got my hands on a pre-release of windows 7 through the DET NSW giving all the students laptops, the students dont have the laptops yet, but the teachers do, so i got to fiddle around on one. Personally i really dont like the …

Member Avatar for kaninelupus
0
637
Member Avatar for rahul8590

Basically its a fault with IDLE, i get this problem a lot, so what i do is i write my code in IDLE and then i run it through the command line. Because as much as you can try there isnt a way around this. I searched for ages, on …

Member Avatar for shadwickman
0
162
Member Avatar for jephthah

[QUOTE=scru;922364]I for one can say that post count says absolutely nothing either.[/QUOTE] Yep, it just tells you how long they have been here, not how good they are :P

Member Avatar for ~s.o.s~
0
577
Member Avatar for fallopiano

You can replace object with other classes, this is called inheritance. For example, we have a class called Shape, We know that: -All shapes have a name so lets write that code [code=python] class Shape(object): def __init__(self,name): self.name = name circle = Shape("circle") [/code] But what if we wanted a …

Member Avatar for fallopiano
0
116
Member Avatar for Norbert X

I think you should just make a reset heath function [code=python] while True: print \ """ Welcome to NorbertQuest! Type: - [battle] to hunt monsters - [shop] to buy weapons - [exit] to quit the game. """ mode = raw_input("What do you want to do?: ") if mode == "shop": …

Member Avatar for Norbert X
0
645
Member Avatar for lllllIllIlllI

I have been using daniweb for about a year and a half now, starting out asking the questions on the Python forum, now i usually answer them. But i really just wanted to say thanks, i feel this is a really strong community and the moderation team does a great …

Member Avatar for ddanbe
0
154
Member Avatar for Menster

Yeah i rekon it will be a bit of fun, something to play with. I doubt the functionality will surpass windows/linux distros so i think your probably going to only see the die-hard fans of Google doing this. Personally im really not that fussed about google knowing what i do, …

Member Avatar for rishabhv
0
297
Member Avatar for SpiritGeek

Your code has a couple of issues, if i am not wrong it will not actually start using threading with your code as it is. You need to add a couple of lines [code=python] class Thread ( threading . Thread ): def __init__(self): threading.Thread.__init__(self) def run ( Self ): subprocess …

Member Avatar for SpiritGeek
0
614
Member Avatar for Ancient Dragon

Ah the life of a mod sounds like so much fun :P if all you do is delete bad posts! Im sure there is more to it then just that

Member Avatar for WaltP
0
153
Member Avatar for clbembry
Member Avatar for lllllIllIlllI
0
265
Member Avatar for Jonx

Yeah, i dont know if you may have checked this. But i know i stuffed this up one time, but are you sure its .jpeg not .jpg or .JPG or something like that? :P

Member Avatar for vegaseat
0
2K
Member Avatar for rockyman12

[url]http://lmgtfy.com/?q=the+pros+and+cons+of+python[/url] See? Its really not that hard.

Member Avatar for Ene Uran
0
125
Member Avatar for joe82

Well you can write a tab by using the escape character and t. So if you were writing a tab to a file you would go something like this: [code=python] f = open("File.txt",'w') f.write("\t This will be indented one tab space!") f.close() [/code] So the \t is the escape sequence …

Member Avatar for joe82
0
4K
Member Avatar for masterofpuppets

[code=python] def eliminate( grid, square, value ): row = square[ 0 ] col = square[ 1 ] poss = grid[ row ][ col ] if len( poss ) > 1: poss.remove( value ) grid[ row ][ col ] = poss # if len( poss ) == 1: # fixValue( grid, …

Member Avatar for masterofpuppets
0
120
Member Avatar for joe82

what i would do is read the whole file into one list, then you can do something like: [code=python] #open it, it is automatically in read mode f = open("dnalookingfile.txt") #get a list with all the lines lines = f.readlines() #iterate through the lines for line in lines: if "rs" …

Member Avatar for joe82
-1
179
Member Avatar for Narue
Member Avatar for leegeorg07

Yeah i did this just a little while ago myself. Here is the tutorial i used for it: [url]http://kutuma.blogspot.com/2007/08/sending-emails-via-gmail-with-python.html[/url] That will work with gmail :)

Member Avatar for shadwickman
0
178
Member Avatar for kes_ee

what have you tried already? [url]http://www.daniweb.com/forums/announcement114-2.html[/url]

Member Avatar for shadwickman
0
129
Member Avatar for tomtetlaw

[code=python] self.Bind(wx.EVT_MENU, self.Close(), id=ID_FILE_QUIT) [/code] Theres ya problem! You dont need to put the brackets after self.Close, the brackets are only used if you actually want to call the function, so take out those brackets and try again. That hopefully should fix your dilemma. :)

Member Avatar for lllllIllIlllI
0
131
Member Avatar for Your_mum

It is used when using formatted strings. I could try explain, but a great book has been written and has a bit about it :) [url]http://diveintopython.org/getting_to_know_python/formatting_strings.html[/url] Read and enjoy the best free book on python imho hope that helps

Member Avatar for Your_mum
0
91
Member Avatar for BigTurtle

I always use the wxPython api when i want to find something out, its a very very useful skill to be able to do that, because of the lack of documentation you really have to try and use what you do have. I once wrote a small explanation on wxTextCtrl, …

Member Avatar for BigTurtle
0
947
Member Avatar for lmr8889

Well to start off with, it sounds pretty simple what you are doing, so just read this tutorial. It is a comprehensive way to start with python. [url]http://docs.python.org/tutorial/[/url] Once you finish that you will be able to do everything but printing, that is a rather advanced thing to do with …

Member Avatar for michellelondon8
0
126
Member Avatar for gislik

[code=python] self.Bind(wx.EVT_BUTTON, self.UpdateNebula(), self.Update_Nebula) [/code] This will not work, you are actually calling the fucntion self.UpdateNebula when you put the parentheses there, so if you get rid of them you will be fine :) Another way i do it a lot is just to bind them to the objects themselves: …

Member Avatar for vegaseat
0
136
Member Avatar for hughesadam_87

if you have a list its as simple as calling the sort() method [code=python] li = ['a','h','w','j','s','r','y'] li.sort() print li [/code]

Member Avatar for lllllIllIlllI
0
96
Member Avatar for shevy24

Learn python [url]http://docs.python.org/tutorial/[/url] Come back when you can do all that and ask a much more specific question

Member Avatar for lllllIllIlllI
0
91
Member Avatar for jimb90

Ha ha ha, i just finished my science assignment on Energy Drinks and their effect on the body. Most energy drinks only have about 80mg/250mL of caffeine. But in Australia there have been about 20 deaths a year occur from people getting all caffeined up and dying.

Member Avatar for Tulsa
0
316
Member Avatar for vandenzergen

Actually guys i made a programming script that does time travel! :P Its called changing the system clock! And i think that thats the best your going to do for the meantime.

Member Avatar for Salem
0
1K
Member Avatar for sravan953

Hahaha, for things like this, i always try and do list comprehensions and get it down to one line, that is not including any of the import statements. I got this [code=python] import random values = 'abcdefghjklmnopqrstuvwxyz!@#$%^&*' print ''.join([random.choice(value) for g in range(8)]) [/code] So what that does is it …

Member Avatar for lllllIllIlllI
0
121
Member Avatar for MidiMagic

Yeah i used to go a flash game site but then they got ads that just constantly talked. And it was annoying to turn off my whole sound just to play something. So eventually i just stopped going there. Im pretty against anything i dont like having access to my …

Member Avatar for MidiMagic
0
206
Member Avatar for hughesadam_87

Yeah, there is another way [code=python] def exit(self): if self.tries == 0: condition = 'false' print 'GAME OVER-' return False remaining_tries = self.tries return remaining_tries [/code] Then just put this at the end of the Main function [code=python] if output_exit == False: return [/code] That way, when it returns false …

Member Avatar for hughesadam_87
0
150
Member Avatar for Aestter

[QUOTE=Aestter;863549]oh ok my bad but i still cant get it to work[/QUOTE] Well show us your changed code so we can have a look at it then.

Member Avatar for sravan953
0
171
Member Avatar for sravan953

Just a quick note. The above code will work if you change all of the instances of "sys" to "os" SO it will look like [code=python] import os os.system("shutdown -s") [/code] Hope that helps :)

Member Avatar for dads
0
158
Member Avatar for zoro007

I dont know if its just me, but that dosent quite make that much sense. Just spend a little more time outlining exactly what you actually want, what your problem is. What you have already tried. Then we will be much better at helping :)

Member Avatar for zoro007
0
110
Member Avatar for mindfad

Also, when i import things i get a syntax error if i have brackets in my import. So that might be it, seeing as it looks like its trying to import NumberStimuliGenerator(revised). Personally i would change the file's name to something without brackets. Seeing as in python, they usually mean …

Member Avatar for mindfad
0
161
Member Avatar for billymcguffin

Okay, thats simple enough. What you would be looking at is using wx.StaticText for all of your displaying text needs. [url]http://www.wxpython.org/docs/api/wx.StaticText-class.html[/url] This you can update with the SetValue("Value") function. If you ever need user input you can use wx.Button [url]http://www.wxpython.org/docs/api/wx.Button-class.html[/url] Or a wx.TextCtrl, this is basically like an input box. …

Member Avatar for billymcguffin
0
359
Member Avatar for aot

Showing images is easy with wx.StaticBitmap. [url]http://www.wxpython.org/docs/api/wx.StaticBitmap-class.html[/url] NOTE:This code is borrowed from the sticky [code=python] # show .jpg .png .bmp or .gif image on wx.Panel import wx class ImagePanel(wx.Panel): """ create the panel and put image on it """ def __init__(self, parent, id): # create the panel, this will be …

Member Avatar for aot
0
255
Member Avatar for kiddo39

Yeah its not too hard to find the size.. There isnt a function but when you open an image it stores it in the size variable. So [code=python] from PIL import Image f = Image.open("10x.png") print f.size [/code] Hope that helps

Member Avatar for kiddo39
0
2K
Member Avatar for Ramy Mahrous
Member Avatar for juzzy

Then you will probably use something called recursion. That is when a function calls itself. It is used in these kind of situations. [code=python] def recurse(num,count): if count == 10: return else: print num/2 recurse(num/2, count+1) recurse(100.0,1) [/code] See, the recursive function has something called a base case. That is …

Member Avatar for juzzy
0
112
Member Avatar for leegeorg07

So do you want something like this? [code=python] password = open('passwords.txt') #each line in passwords.txt will have another passwords password_list = password.readlines() guess = raw_input("Enter the password: ") if guess in password_list: #print short story else: print "wrong password, program exiting" raw_input() #raw_input is there so the user can see …

Member Avatar for leegeorg07
0
544
Member Avatar for mohankumar554

Well here is some code that will raise that error [code=python] >>> l = None >>> l[0] Traceback (most recent call last): File "<pyshell#7>", line 1, in <module> l[0] TypeError: 'NoneType' object is unsubscriptable >>> [/code] Now what that error means is that you have something of NoneType, literally it …

Member Avatar for lllllIllIlllI
0
184
Member Avatar for CommanderOne

The second one is a simple funciton [code=python] #our list l = ['Hello','world','from','python'] #use the join() function to join the words together with spaces string_list = ' '.join(l) print string_list #prints #Hello world from python [/code] Im pretty sure that changed for python 30. Im not how you do it …

Member Avatar for woooee
0
137
Member Avatar for lllllIllIlllI

I was just wanting to tell you (cscgal) that i was unable to access the site for about 3 hours last night (Australian Time). I kept getting a database error, it asked me to refresh or email you guys. I couldn't get to any part of the site at all, …

Member Avatar for Dani
0
38
Member Avatar for dinilkarun

[QUOTE=dinilkarun;866461]Hi All, I have created a grid and want to implement the following idea: The user should be able to enter only numeric values in any of the cells in that grid. I could not get any property of the cell which can check for the entered data. Please guide …

Member Avatar for lllllIllIlllI
0
139
Member Avatar for scheda

[QUOTE=jlm699;864499]So what are the chances of starting a pyQT or pyGTK thread like the wxPython thread we have... sticky and all! I'd love to see some examples of either pyQT or pyGTK as I've no experience with either... Thoughts?[/QUOTE] Yeah i would like to see that as well. And if …

Member Avatar for vegaseat
0
138
Member Avatar for quietasamouse

To get the average i usually make a function [code=python] import random def averageList(l): total = 0 for item in l: total += item return total/len(l) #then i make my list l = [random.rangrange(0,100) for f in range(100)] print averageList(l) [/code] Functions are a great way to reuse your code …

Member Avatar for lllllIllIlllI
0
77
Member Avatar for DisembodiedLoaf

Okay, start simple and understand what raw_input and input actually do: [quote=http://docs.python.org/library/functions.html] raw_input([prompt])ΒΆ If the prompt argument is present, it is written to standard output without a trailing newline. The function then reads a line from input, converts it to a string (stripping a trailing newline), and returns that. When …

Member Avatar for sneekula
0
77
Member Avatar for VernonDozier

Really i think naming your son/daughter something like adolf or the like is more then child abuse. Its stuck with them their whole life (unless they change it) so its kinda whole life abuse, not just child abuse :P

Member Avatar for sneekula
2
485
Member Avatar for sneekula

Yeah i got a Dell inspron mini 9. One of the netbooks and it runs linux so well. I spent ages getting confused about how to install applications until about a week later i found the add/remove programs item. Woops! But i love its speed and its community. Hope you …

Member Avatar for MaxVK
0
332

The End.