Member Avatar

Is their a python module that can get the dimensions of a video file?

Member Avatar
+0 forum 4
Member Avatar

I have been trying to make a class based on Tk(). My code is such a mess, I would be embaressed to show you what I came up with. Here is what I am trying to do [code] class Window(Tk): fill in the code here win = Window() win.mainloop() [/code] I can do this with out using classes, but as a single object I am having trouble I would like the window to be a certain dimension, and have a single button in it. I would greatly appreciate an example.

Member Avatar
+0 forum 3
Member Avatar

I have been messing around with some scripts, and would soon like to start making a few gui apps. I plan on using either tkinter, or possibly pygame, or pygtk. Are there modules already built that will allow you to browse graphically? for instance, choosing a file, or directory, using a gui button? It would be such a common feature, I would think this is already been done.

Member Avatar
+0 forum 3
Member Avatar

I am having a tough time understanding what is going on in this following code [code=python] class Player(object): """ A player in a shooter game. """ def blast(self, enemy): print "The player blasts an enemy.\n" enemy.die() class Alien(object): """ An alien in a shooter game. """ def die(self): print "The alien gasps and says, 'Oh, this is it. This is the big one. \n" \ "Yes, it's getting dark now. Tell my 1.6 million larvae that I loved them... \n" \ "Good-bye, cruel universe.'" # main print "\t\tDeath of an Alien\n" hero = Player() invader = Alien() hero.blast(invader) [/code] in …

Member Avatar
+0 forum 9
Member Avatar

Is there a way to get the day of the week when supplied with a date? Like November 11, 1911 may be a Monday?

Member Avatar
+0 forum 2
Member Avatar

Hello, I started coding a little app for exploring the mandelbrot fractal. Hopefully someone here is familiar with it, and perhaps tried coding it in python. My problem is, as you will see if you try running my code, is that the generated image is NOT the mandelbrot (although it is fractal and similar in a sense). And I just cant figure out why this is. So my hopes are that this is due to some oddity of python I am hitherto unaware of - I can't see any misstakes in the algorithm itself (although it might be there anyway …

Member Avatar
+0 forum 1
Member Avatar

I was wondering if anyone knows if any Python books that are availible,and where I might be able to purchase them?

Member Avatar
+0 forum 8
Member Avatar

I have looked through the forums for this and found several hits but none of them truly answered my question. How can I make a Python program an executable file that does not require my friends to have Python installed on their computers?

Member Avatar
+0 forum 4
Member Avatar

Is there any place where you can find a complete list of python commands? I have googled and skimed through the tutorial and I can't find any place where I can find a complete list of python commands and examples on how to use them? If there isn't one I suggest that we make one! We create a wiki where anyone can post a command and an example to go with it! For example: LIST OF COMMANDS IN PYTHON 1.) print Used to display text Example: print "hello world" Result: hello world Any ideas on how to do this? Comments? …

Member Avatar
+0 forum 3
Member Avatar

Hello, I got my last issue resolved, working great thanks to you guys. I have a wide variety of date formats that I need to parse into this format: MM/DD/YYYY HH:MM:SS (a mysql DATETIME type value).. I have tried: [code]post_date = time.strftime("%Y-%m%d %H:%M:%S", i.issued)[/code] However, this gives me: [code] Traceback (most recent call last): File "./parse.py", line 34, in ? print time.strftime("%Y-%m-%d %H:%M:%S", i.issued) TypeError: argument must be sequence of length 9, not 20 [/code] i.issued is a variable, with this as an (example) value: (2005, 7, 24, 15, 32, 0, 6, 205, 0). I believe this is called a …

Member Avatar
+0 forum 1
Member Avatar

Hello, This is my first python script, so I could use a little bit of help here. :) I'm using the 'Universal Feed Parser' ([url]http://feedparser.org/)[/url], and I have a list of feed URLs in a database which I would like to pull out and go through each of them. I am also using the ADOdb database module, as I am familier with it (in PHP .. however, it is pretty similar ..) Here's what I have so far, the only thing this does is pulls the URLs out of the database, and prints them: [code] #!/usr/bin/env python import MySQLdb import …

Member Avatar
+0 forum 6
Member Avatar

I have just started getting into python and so far it's all been very interesting and the help good to, but now i have ran into a problem. I'm sure it's very easy to solve but i just can't seem to figure it out or find anything on the web. I have made a GUI and i want to make it so that when a button is pressed it will call my client script and run it, But i have no idea how to add this to the button i have. Any help would be fantastic.

Member Avatar
+0 forum 8
Member Avatar

Hi, I'm writing a client program that downloads data from an HTTP server via urllib, like so: [CODE]ufile = urllib.urlopen(urlstring) text = ufile.read() # Do stuff with text[/CODE] Nice and simple. Unfortunately, the server only accepts requests with a session ID embedded inside - and I don't know how to open sessions using urllib. I've tried looking in the forums here and elsewhere online, and all I got was very generic info on cookies - nothing specific to Python, really. Does anyone have experience doing this? Can you send me a link? [B]EDIT:[/B] I found out about cookielib; I'm seeing …

Member Avatar
+0 forum 3
Member Avatar

hi :) I need some help for this script I have -------------------- [CODE]cursor = conn.cursor() cursor.execute("select * from playlist limit 5") result = cursor.fetchall() # iterate through resultset playlist_txt = '' for record in result: mp3id = record[0] mp3_title = record[1] mp3_artist = record[2] playlist_txt += mp3id + mp3_title + mp3_artist #print mp3id , " - ", mp3_title , ' - ', mp3_artist , "<br />" cursor.close() conn.close()[/CODE] ------------------ #and want to print this out of "for record in result:" [CODE]print playlist_txt[/CODE] #but there is an error in [CODE]playlist_txt += mp3id + mp3_title + mp3_artist[/CODE] 10x in advance :)))

Member Avatar
+0 forum 4
Member Avatar

I have been reading through the "python library reference" with no luck finding the module needed to copy a file. Any help would be appreciated.

Member Avatar
+0 forum 3
Member Avatar

I need root privledges to do some stuff in my python script. I am currently using this technique [php] current_user = os.geteuid() if current_user != 0: print "you need to be root to run this script" sys.exit()[/php] this will at least polietly end the script so i am able to log in as root. then start the script as root user. Is it a very involved process to have the script prompt me for my root password and switch users?

Member Avatar
+0 forum 1
Member Avatar

Hello Everyone! My question is simple, where are any half decent tutorials out there? I mean, all of the ones I've tried have only skimmed the surface(print, name = raw_input yah know things like that)- or were way to complicated. I've only been doing this for something like a week

Member Avatar
+0 forum 2
Member Avatar

Hello, I am relatively new with Python and Pygame, however, I am an experienced PHPer, so programming isn't something new to me. My problem is this: I got Python 2.4 installed and Pygame 1.6 for Python 2.4 installed. I know Pygame works because I can make calls to the Pygame modules. My problem is, when I try to open a window through Pygame using [code]screen = pygame.display.set_mode((468, 60))[/code] it opens a window, but then lags, and finally crashes and I have to use the oh-so-lovable Crtl-Alt-Del to kill it. I can't figure this out. If I use Tkinter to open …

Member Avatar
+0 forum 3
Member Avatar

I just want to say that I am very disappointed with Guido van Rossum's latest tutorial. I like to follow along typing in the examples and seeing how they run. I seem to catch on to things better that way. But this tutorial's examples haven't been throughly checked because some of them are just not good. Yes, things are free, and yes I like Python and yes, thanks to Guido for allowing the world to use his work without charge. I will give a couple of examples: Section 4.4 looking for prime numbers. Section 4.7.1 default arguments. I stopped at …

Member Avatar
+0 forum 3
Member Avatar

I have been working on some python code with a friend and for some reason i keep getting this message when i try to run his code, if ar[2]!="client": IndexError: list index out of range I can't see whats wrong and i have never had this message come up before??

Member Avatar
+0 forum 4
Member Avatar

Hello all! Ok here's my problem: I have a Hello World type program that I want to run in steps, and each step is in a new window. When a "next" button is pressed the old window terminates and a new one is created. Now I don't know much about the command = whatever thingy so I was wondering if you could give me some info on it? Oh and I mostly work with .bind so if so can you give me the example in that form? Help appreciated.

Member Avatar
+0 forum 1
Member Avatar

Ok, I've only been working with Python for something like 4 days now and I'm stuck trying to do a certain thing in Tkinter. Now, just to get you into the situation here. I've created a little program that has an entry bar and a go button. It says for you to enter in your name in the entry box and click the go button. What should happen is after the person enters in his/hers name and clicks the go button it should print something like Hello, "name" [U]inside the window as a label or in a separate window as …

Member Avatar
+0 forum 4
Member Avatar

I have heard that it is possible to compile python so that people reciving the script don't need to worry about going to the python website and downloading it. One more thing if you tell me to run something from the prompt I can't for the life of me run a python script from the prompt, I've typed in the path and everything but it comes up with bad command or filename. Help appreciated. Oh and i have no idea on how to get it to compile or create the setup script or what to put at the beggining of …

Member Avatar
+0 forum 1
Member Avatar

python -------------------------------------------------------------- [url]www.python302.tk[/url] [email]python302@gmail.com[/email] -------------------------------------------------------------- ALL FOR YOU SPIDY -------------------------------------------------------------- Disclaimer: This paper is not to be copied, or used on any website without my permission, consequences will occur if it has been found on ANY website. Only time it is allowed to be used on a website is with my permission, and proper credit must be given. -------------------------------------------------------------- 1.the question comes what exactly is python? well my answer is it is a object oriented,scalable, platform independant,quick and easy to use programming language. last but not the least it is a open source software well supported by the G.N.U.i love …

+1 forum 0
Member Avatar

I am slowly absorbing these python class concepts(kinda) this fails with an error [php] class Critter(object): def __init__(self): print "I am born" def talk(self,name): self.test = name print self.test crit = Critter('ralph') crit.talk()[/php] this one works [php] class Critter(object): def __init__(self,name): print "I am born" self.test = name print self.test def talk(self): print 'ya' crit = Critter('ralph') crit.talk()[/php] Is the following statment true for the most part. if a parameter is passed directly to the object, it is passed down to the __init__ constuctor only, not to any other methods. That would mean the only way to get data into …

Member Avatar
+0 forum 5
Member Avatar

Hey there all, i have a question about how to point my python install to my sql database. when i enter this:[CODE] db = MySQLdb.connect(user="user", passwd="pass", db="myDB")[/CODE] i get this: [CODE]Traceback (most recent call last): File "<pyshell#1>", line 1, in -toplevel- db = MySQLdb.connect(user="user", passwd="pass", db="MyDB") File "/usr/lib/python2.4/site-packages/MySQLdb/__init__.py", line 66, in Connect return Connection(*args, **kwargs) File "/usr/lib/python2.4/site-packages/MySQLdb/connections.py", line 134, in __init__ super(Connection, self).__init__(*args, **kwargs2) OperationalError: (1049, "Unknown database 'MyDB'")[/CODE] i am using the all in one package from lampp (now xampp) and i have tested a couple of python scripts from the cgi, but.... nothing that connects to the database. …

Member Avatar
+0 forum 3
Member Avatar

I was wondering if there was any way to make a for loop go through a string word by word, rather then character by character. For example, [B]for letter in "Hello world"[/B] [B]print letter[/B] it would print out H e l l o etc. I was wondering if I could make it so that it would instead print out like Hello World Any help would be greatly appreciated!

Member Avatar
+0 forum 4
Member Avatar

Hello!! Does anybody know how to create a function that randomly changes elements in a string? And: does anybody know how to set the chances for the type of changes? I've tried to look it up in tutorials, but since I'm a beginner, most of the time creating random outputs, requires a lot more Python knowledge than I currently have. Thanks in advance!

Member Avatar
+0 forum 5
Member Avatar

Sorry, I know that this is probably the wrong section to post this question in, but I'm sort of confused as to which one would have been appropriate. Anyways, I've been using regular expressions to find specific information such as e-mail addresses and whatnot inside textfiles, but I can't get my head over this one problem. The problem my expression faces, is getting it to stop looking at a string. I was wondering if there's anyway I could expand the NOT parameters to include entire strings, rather then just one character. For example, given the string: [COLOR=Green]Only pick up strings …

Member Avatar
+0 forum 4
Member Avatar

I'm trying to finish up my first Python program. The program was built to help me maintain and add content to my webpage (it's nothing fancy...just pure html). Everything was smooth sailing (hey, python kicks some serious butt), until I ran into problems using retrbinary() to download files. The problem lies in the FTPDown() function of my program. When I try to execute the funcition i get a fun error message: [code] Username and Password successfully verified 220 FTP Server ready Downloading last.htm Traceback (most recent call last): File "HTMLFixer.py", line 303, in ? MainMenu() File "HTMLFixer.py", line 212, in …

Member Avatar
+0 forum 1

The End.