614 Posted Topics
Re: 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, … | |
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 … | |
Re: > 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 | |
Re: 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 … | |
Re: 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 … | |
Re: 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 … | |
Re: Yeah shadwickman. I have a funny feeling that it is not python. I get a clue from the *endif and stuff like that... | |
Re: 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 | |
Re: [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 … | |
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 … | |
Re: 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. | |
Re: 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 … | |
Re: 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. | |
Re: [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 … | |
Re: 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 … | |
Re: 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. | |
Re: 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", … | |
Re: [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. | |
Re: 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 … | |
Re: [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 … | |
Re: 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 … | |
Re: 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! :) | |
Re: 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 … | |
Re: [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 … | |
Re: 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 … | |
Re: 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. :) | |
Re: 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 … | |
Re: 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 … | |
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 … | |
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 … | |
Re: 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 … | |
Re: 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. | |
Re: Well give us a look at an example file that you are using. That will help greatly. | |
Re: 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. … | |
Re: 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] … | |
Re: Umm.. i would edit those passwords there. Just asterisk them or something. | |
Re: [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 … | |
Re: 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:] … | |
Re: [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 … | |
Re: 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 … | |
Re: 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): … | |
Re: 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 … | |
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 … | |
Re: 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] | |
Re: 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. | |
Re: 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 … | |
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> … | |
Re: 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" … | |
Re: 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 … | |
![]() | Re: 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 … ![]() |
The End.