614 Posted Topics

Member Avatar for shadwickman

I did something exactly like this when learning python. I would get the rain radar and the forecast for numerous places. The way i did this was i would download an image from the Bureau of Meteorology in Australia, then i would download the webpage with my forecast on it, …

Member Avatar for shadwickman
0
123
Member Avatar for lllllIllIlllI

Hi, I was just posting on the python forum when i tried posting python code and it came out weirdly. I shall show an example. This is not with any noparse or anything. And it dosent wrap it in code tags correctly. You just see the text code=python [code=python] print …

Member Avatar for lllllIllIlllI
0
346
Member Avatar for kenji

> PS. What's the Python code tag? When I call (code=python) I don't get the formating or syntax highlighting. Yeah thats an issue right now. http://daniweb.com/forums/thread189444.html

Member Avatar for vegaseat
0
136
Member Avatar for txwooley

Well this was fun, i made myself a little list comprehension to do this for me :) [code] #Your list is called f in my case >>> f = [150,2,16,5,5,1,3,2,1,3,6,6] >>> print [str(g+1)+" : "+str(f.count(g+1)) for g in range(min(f)-1,max(f)) if f.count(g+1) > 0] ['1 : 2', '2 : 2', '3 …

Member Avatar for txwooley
0
114
Member Avatar for dliving

Aww you were so close, your code tags are almost perfect. All you have to do is have the[noparse] [/code] [/noparse]tag on its own line. Just repost the code like that and it will have the right indentation and make it easier to us to help you. As for printing …

Member Avatar for woooee
0
340
Member Avatar for Zanbi

Usually this is fixed pretty easily. Shut down all IDLE's open, and any other programs that could be using python. Then you proceed to the task manager (CTRL+ALT+DEL) and go to the processes tab. End any processes that have python.exe or pythonw.exe Once that is all done, try restarting IDLE …

Member Avatar for lllllIllIlllI
0
1K
Member Avatar for Joe Hart

Yeah shadwickman. I have a funny feeling that it is not python. I get a clue from the *endif and stuff like that...

Member Avatar for shadwickman
0
167
Member Avatar for breatheasier

could you post there error you are getting? oh and instead of [code] xy=(1,1) xy=list(xy) [/code] You can just go [code] xy = [1,1] [/code] And then it is a list already

Member Avatar for vegaseat
0
269
Member Avatar for action_owl

[QUOTE=scru;856510]Somebody should make a sticky thread titled "Can python do this?" with a single one-word post that reads: "Yes."[/QUOTE] Yeah but a quick no for "Can python make a 3d world that i can walk around in?" or something to the like. That is unless you are really into it …

Member Avatar for vidaj
0
144
Member Avatar for lllllIllIlllI

Hi Just about a week ago i hooked up my VGA cable to my laptop instead of my desktop. Then i turned on the desktop just to make all the network shares available. But then i about two days ago i tried to put the monitor back to the desktop …

Member Avatar for caperjack
0
95
Member Avatar for dinilkarun

What GUI engine are you talking about? No-one can help with that little information. Spend a little more time on your question and the answer will come a lot quicker.

Member Avatar for lllllIllIlllI
0
94
Member Avatar for xeo

I googled "hard disk serial number python" and came up with something that did this: [code=python] import win32api print win32api.GetVolumeInformation("C:\\") [/code] It prints out a number of things like the file system and name, im not sure if it has the serial number but thats what other people on the …

Member Avatar for EAnder
0
6K
Member Avatar for alicem

Im pretty sure that using the Image module is unnessicary for that. I think you can just use os and go: [code=python] import os os.startfile("image.jpg") [/code] Yep, just checked, it works perfectly on my computer.

Member Avatar for alicem
0
73
Member Avatar for taboyo22

[code=python] def bubblesort(list): for passes in range(len(list)-1, 0, -1): for index in range(passes): if list[index] < list[index + 1]: list[index], list[index + 1] = list[index + 1], list[index] return list print bubblesort([3,2,66,5,22,62,61,16]) [/code] The return statement can be printed just with the keyword print. I dont know if that is …

Member Avatar for jlm699
0
87
Member Avatar for shiva666

python is really useful when it comes to saving files. There is a csv module if i am not wrong. But you can do simple text file manipulation with just standard python. [code=python] #open file.txt and set to write (w) mode f = open("file.txt",'w') #write lines to file, need to …

Member Avatar for shiva666
0
64
Member Avatar for invinate

Hi, it would be really handy if you could post your code. That way we can look at it and try and debug it that way.

Member Avatar for invinate
0
87
Member Avatar for maybetuesday

There are a couple of issues i can see. The first of which is a lack of code tags. [noparse] [code=python] [/code] [/noparse] This is the corrected code.. i think, some indentation might be out depending on when i thought a certain loop might end. [code=python] def grayscale_progress(path,imagelist): app=wx.PySimpleApp() dialog=wx.ProgressDialog("Grayscaling", …

Member Avatar for lllllIllIlllI
0
199
Member Avatar for jworld2

[QUOTE=vegaseat;843438]Yes, zipfile=None is important if you just want one exe file with everything in it! Haven't totally tested the code, so you are my labrat.[/QUOTE] Well i tried it and it worked fine. Probably the best setup script i have come across, thanks vega.

Member Avatar for jworld2
0
133
Member Avatar for Mearah

Yeah i spent about 3 weeks a while ago trying to work out pyGL but there was absolutely no documentation or tutorials to do so i was stuck and there really was no way for me to learn. IMHO i think you should probably use something like VPython or another …

Member Avatar for Mearah
0
682
Member Avatar for docesam

[QUOTE=docesam;846544] 5- can access a scanner and input pictures from it. thankx in advance :)[/QUOTE] [QUOTE=Mearah;846573]Hey docsam, "can access a scanner and input pictures from it" I guess this is possible too, but never tried it on my own before. so have a nice time with python. Mearah[/QUOTE] Well i …

Member Avatar for Mearah
0
168
Member Avatar for max.yevs

Ah just a simple misunderstanding. Firstly you can do it this way [code=python] n = input("Enter your number: ") print(n+2) [/code] But that wont work with python 30. Also in python 2.x people dont usually like the input() function as it evaluates the input. So if i typed 2*7 it …

Member Avatar for jlm699
0
115
Member Avatar for tschafer204

Or you could use formatted strings! Have a look at the tutorial here:[url]http://diveintopython.org/native_data_types/formatting_strings.html[/url] [code=python] l = [['a', 'b', 'c', 'd'],['e','f','g','h']] for item in l: print "%s %s %s %s" %(item[0], item[1],item[2],item[3]) [/code] That should do it! :)

Member Avatar for tschafer204
0
90
Member Avatar for katamole

Oh i did exactly the same exercise myself when learning about lists, what you need to know here is about the "in" keyword. It is used to check if "a in b" so what we can do is check if item a is in list b. If it is then …

Member Avatar for woooee
0
181
Member Avatar for zublacko

[QUOTE=zublacko;846155]ok well im looping to find a specific detail, but there are like 5 specific detail to find. When I do my while loop i keep getting the first one only how do i make it jump to the next one and store the other detail?[/QUOTE] Okay, a tad more …

Member Avatar for jlm699
0
95
Member Avatar for max.yevs

Yeah you can do open internet things with the webbrowser module. Oh and also execfile is good if you want to start executables or python files. [code=python] >>> import webbrowser >>> webbrowser.open("www.google.com") [/code] And execfile [code=python] #its a built in! execfile("Path \\ to\\ exe or py \\ file.exe") [/code] Hope …

Member Avatar for max.yevs
0
123
Member Avatar for tondeuse34

If you just re-installed python you might have installed python 30 which means that you now have to go [code=python] print("hello") [/code] See if that fixes it. :)

Member Avatar for adam1122
0
67
Member Avatar for harrykokil

You cant just get a value from a button, buttons are basically used to call events and such, so you would need some kind of text entry and then when the button event was called use the assert keyword. Assert is a keyword that raises an error if its requirements …

Member Avatar for lllllIllIlllI
0
150
Member Avatar for demeryjo

Well firstly you were close with the code tags. It goes [noparse] [code=python] [/code] [/noparse] But if that is your full code then there are a couple of things that you need to do. The first of which is instantiate it. This means that you have to create an instance …

Member Avatar for lllllIllIlllI
0
90
Member Avatar for lllllIllIlllI

Just wondering what people thought about the update to how the profile gets viewed. Personally i kind of like it but then there is no posts/day thing. Im not sure whether thats a good thing or not personally. To the site admins and such, is there any reason for this …

Member Avatar for verruckt24
0
179
Member Avatar for lllllIllIlllI

Hi, I have been exploring doing some GUI programming with the wxWidgets toolkit as i am used to that from programming wxPython in python. I am doing the tutorials from zetcode and i am very mystified. (i think i spelt that wrong). This is the url [url]http://zetcode.com/tutorials/wxwidgetstutorial/menustoolbars/[/url] Its the first …

Member Avatar for lllllIllIlllI
0
120
Member Avatar for aegis042404

Well then i would have a look at wxStaticBitmap, that will handle your images no worries, then you can look at wx.Media.MediaControl for playing your files. Then you just have to bind the buttons in the usual way. wx.StaticBitmap [url]http://www.wxpython.org/docs/api/wx.StaticBitmap-class.html[/url] wx.Media.MediaCtrl [url]http://www.wxpython.org/docs/api/wx.media.MediaCtrl-class.html[/url] I wrote tutorials on how to use both …

Member Avatar for lllllIllIlllI
0
362
Member Avatar for BlueNN

just put [icode]raw_input("Press enter to close")[/icode] at the end of your code and then it will wait until you press enter to close. This is how i got around that problem.

Member Avatar for BlueNN
0
145
Member Avatar for tomtetlaw

Well give us a look at an example file that you are using. That will help greatly.

Member Avatar for tomtetlaw
0
86
Member Avatar for tomtetlaw

Usually if you want to save something like a dictionary you will use something along the lines of pickle, what that does is it saves the dictionary/class/anything practically using an algorithm and then you can load that file again and the dictionary/class/anything will be back like you had it before. …

Member Avatar for lllllIllIlllI
0
71
Member Avatar for snowfish

If you want really safe encryption that will stop people just looking at your source code and finding the password you need to use something like md5. This can encrypt a string (password) and then it is nigh impossible to decrypt it. Here is an example i whacked together [code=python] …

Member Avatar for lllllIllIlllI
0
10K
Member Avatar for chaney44145
Member Avatar for chaney44145
0
183
Member Avatar for Malestryx

[QUOTE=shadwickman;837532] Shouldn't [code=python] if h <= 0: print "Can't work less than 1 hour a week!" [/code] be changed to [code=python] if h < 1: print "Can't work less than 1 hour a week!" [/code] [/QUOTE] That wont change anything because h<=0 will be true if h is 0 or …

Member Avatar for woooee
0
106
Member Avatar for ning2009

I had the answer for this an hour ago but suddenly the site stopped responding. For this problem you have to split the string into bits and the count the amount of bits.. that sounds really bad.. here is some code that demonstrates this [code=python] def Digit(line): line = line[line.rindex("J")+1:] …

Member Avatar for ning2009
0
107
Member Avatar for Skimy

[QUOTE=scru;835154]Worth noting: This was "fixed" in Python 3; 5/10 now gives 0.5[/QUOTE] Correct me if i'm wrong but to do an integer division in python 3 don't you now do // rather than just the usual /. Wait just checked it, to do integer division in python 3 you use …

Member Avatar for chaney44145
0
116
Member Avatar for wolih

Yeah +1 to tomtetlaw. Classes are definitely the way to go. They provide a great way to put all your functions together as well as data that needs to interact can and will. If you need to have a peek at classes then have a look here [url]http://www.python.org/doc/2.5.2/tut/node11.html[/url] B But …

Member Avatar for tomtetlaw
0
102
Member Avatar for kiddo39

Yeah shadwickman is right, i did just that for one of my programs i used this kind of loop: [code=python] unsorted = #list of all image values RGB ROWS = #amount of rows in image COLLS = #amount of collumns imagevals = [] count = 0 for f in range(len(unsorted)/ROWS): …

Member Avatar for lllllIllIlllI
0
147
Member Avatar for tomtetlaw

I brought up practically exactly the same issue as you did a few months ago. [url]http://www.daniweb.com/forums/thread148140.html[/url] Eventually though i used VPython instead: [url]http://vpython.org/[/url] It does 3D and is pretty easy to understand. Have a look at the thread to see some of the things that is can do, all thanks …

Member Avatar for lllllIllIlllI
0
104
Member Avatar for lllllIllIlllI

Hi everyone, I just became a community sponsor and i was fiddling around with my account doing some changes to some things that i could do now and i realized that my post count has jumped from 524 to 604 without a single post from me! I looked at recent …

Member Avatar for MidiMagic
0
177
Member Avatar for Z8934

I think its because of a thing called polymorphism.. i could be wrong and sorry if i am but have a look at it here: [url]http://en.wikipedia.org/wiki/Polymorphism_in_object-oriented_programming#Python[/url]

Member Avatar for Gribouillis
0
159
Member Avatar for Foxcow

I fixed that on my machine (XP) by opening up task manager, and going to process and ending any "python.exe" processes. That fixed it for me every time. But it really depends, sometimes it works others it dosent do a thing.

Member Avatar for lllllIllIlllI
0
92
Member Avatar for lilkid

You can read the text file word by word! :) [code=python] d = {'flight':[]} f = #text file for line in f: for word in line.split(): if word == what_you_want: d['flight'].append(word) [/code] Hows that? Im a bit confused by exactly what you want but that will read a text file …

Member Avatar for lilkid
0
164
Member Avatar for lllllIllIlllI

Hi I have a sorting applet that implements Bubble Sort and Insertion sort, and i have a couple of classes in my program. I made it using netbeans and i have no main class, and when i run it using this code: [code] <html> <applet code=Sorter.class width=800 height=300> </applet> </html> …

Member Avatar for lllllIllIlllI
0
366
Member Avatar for jessica2009

What that means is that the indentation level is not correct, this is best explained by examples: [code=python] if True: print "this" print "That" ##Error!! The indentation is not standard if True: print "this" ##Error!! No indentation if True: print "This" print "That"#Error, indentation not correct. if True: print "This" …

Member Avatar for vegaseat
0
129
Member Avatar for harrykokil

Threading is used to run two things at once so it could help you if needed a collision detection method to run and to run the cars as well. But personally i think you could do it without threading in pygame, all you would do is use image.rect.colliderect() and that …

Member Avatar for scru
0
67
Member Avatar for leegeorg07

Personally i think in the end that it would be easier if you used a GUI, that way you could control everything so much easier. If you are interested in a GUI it will mean added control as well as less difficulty with some things such as making sure that …

Member Avatar for leegeorg07
0
316

The End.