15,181 Topics
| |
I did a project last year in VB for image processing, basically link to a folder, load an overlay and loop through the folder overlaying a watermark. I now need to get the same thing running in python to cater for cross platform use. I have translated all the image … | |
Hi all, for the following string I want to search a pattern The string is lcpstr = "2008/03/25 log:true lcp: 78888 -> 100 lck=0 to=900 un=5840 l=0 BMN" If I take the pattern as "lcp: 78888", pattern checking is successful when I give the following statement: temp = re.search("lcp:"+" "+'[0-9]+'+" … | |
This is the question i was given --------------------------------------------------- Here is a program that prompts the user to enter a student’s marks, and then prints out whether they have passed or failed a unit. '''calculate a students grade given their final mark''' def calcFinal( asg1, asg2, exam ): final = asg1 … | |
I'm a newbie so please be patient... :) [CODE]def canvas(self): import qt self.setCaption('My Canvas') c = qtcanvas.QCanvas(self) # <- gives the canvas a parent QObject c.resize(315, 207) v = qtcanvas.QCanvasView(self) v.setGeometry(QRect(200,590,321,211)) lay = qt.QVBoxLayout(self) lay.addWidget(v) v.setCanvas(c) l = qtcanvas.QCanvasLine(c) l.setPen(qt.QPen(qt.Qt.black)) l.setPoints(10,10,390,390) l.show() v.show() c.update() l1 = qtcanvas.QCanvasLine(c) l1.setPen(qt.QPen(qt.Qt.red)) l1.setPoints(20,60,10,230) l1.show() … | |
The askdirectory window in tkinter has a fixed size. My folders are deeply nested with long names. I would like to make the window larger so one can read the entire path. (I'm in WinXP) Is there a way to set the size of the askdirectory window or make it … | |
i have 2 list contaning 4 element i must create 2 new list which contain 2 element 1st new list must contain an element from each original list 2nd list must also contain 2 element apart those of the 1st new list | |
I have to get three pieces of information from the files i have 1. The name of the owner of the file which appears after the pattern tag <foaf:name> 2. The ID of the owner of the file which is embedded in the filename, e.g., http%3A%2F%2Ftalk.ie%2Fvbulletin%2Ffoaf.php%3Fu%3D12 belongs to user 12. … | |
ok I had looked on the internet and found one form of running an exe file from a py script, i goes like this. [CODE]import os os.system("c:/windows/iexplore.exe") # Or wherever it lives[/CODE] Problem is, whenever i run the script with the appropriate path loaded in, i get the following: [CODE]Traceback … | |
Hi guys! I am in the process of making a game...similar to this one: [url]http://www.miniclip.com/games/nfl-lateral-collateral/en/[/url] I am using the following code to detect key presses: [CODE] pygame.event.pump() key = pygame.key.get_pressed() if key[pygame.K_LEFT]: ... [/CODE] How can I detect if a key is released? I have seen this done with using … | |
Write a python function which takes one argument, which is a word(as a string),and returns true if the word contains the same number of vowels as consonants. Then write a short piece of code to read the above file and print out all such words.For example the words such as … | |
I have been given an assignment to create a random race program where 2 different lines race. How the lines travel is determined by a random number generator, but that is not the issue I currently have. I am suppose to create a window that is 500x600, with the x- … | |
A non-robot problem (Should be submitted independently). Write a Pyhton program, called Scores.py, which reads a collection of exam scores (integers) ranging from 1 to 100 and counts and prints the number of `A' scores, `B' scores, `C' scores, `D' scores and `F' scores based on the following grading scale: … | |
Good day, any ideas on how to implement edge scrolling for wxPython. Panel used is a wx.ScrolledWindow here's a sample screen shot of the tool. The red areas indicates the edges of the map panel where the scrolling will be triggered. [url]http://i40.tinypic.com/wsmo95.jpg[/url] Thanks in advance! | |
I need a qtimer to trigger reading of a file line by line, I have the code working running with the timer trigger but qtimer will just read the first line over and over as it is now. Here is the code so far: self.lcdtimer = QTimer() self.connect(self.pushButton85,SIGNAL("clicked()"),self.update) self.connect(self.lcdtimer, SIGNAL("timeout()"), … | |
I am a student in my first python programming class in college and I am trying to figure out how to do my latest lab assignment. Could anyone just give my a hint on how to get a file (I know how to import it into the program) into dictionary … | |
I am starting to play around with IronPython, but I can't figure out how to convert any code to executable file that will run on Windows. There has got to be some kind of batch file. | |
Hi all, I ahve got a requirement of searching for a string in a text file and then return that string. I also need to convert that to numerical value Could anyone please tell me how to do it? The requirement is precisely like this: First I need to search … | |
I am trying to write text into a windows edit control using python. it seems to write to every control i try except the edit box not sure if this is a security measure or not. here is my code any help will be greatly apprciated. [code] import os,sys,subprocess,time from … | |
I am a programming and python beginner and thought this would be a fun exercise. I wrote this script to mine web pages. First it finds all of the hrefs on the page. Then it takes those urls and searches those pages for content. This is by no means perfect. … | |
Hi, I'm processing a small text file which contains information about the Winter Olympics. However I don't know how to keep the list the same for each country whilst making a new list for a different country. So far I've read in the lines and I have put the data … | |
My friend gave me 10,000+ ROM's for Sega, SNES, NES, and GBA. They where all individually zipped. I go fed up trying to unzip them one by one, and decided to write a script to do it for me. It unzipped about 5,000 in under a minute. Python's zipfile module … | |
Hello In my program I am using a menu that uses a multi-way if statement to do what the user inputs (1 of 3 values). After printing the menu I use a raw input statement to get the user's input. However, is there anyway to define the user's input variable … | |
I am trying to write a program that prints every line of the file until a certain string is found. The file is a plain text file. I put the sample context at the top of the code. But the function gets stuck in an infinite loop. I don't want … | |
Hi, the problem is that: I have a text file with some lines of text in it. I have to search for a particular line in the file and then copy the lines after the searched line into another text file. This search string comes only once in the text … | |
Hi all. There might be a simple solution to this but I've been googling for quite a while for a solution... I want to get the plots generated by the module matplotlib from Python in an interactive window so I can save the graph. I'm using Ubuntu 9.10 and things … | |
Hello I'm writing a python program and need some help. Firstly, is there anyway to include variables in an input prompt? For eg. [variable1 = 4 variable 2= 3 variable= raw_input("Please enter a number between", variable 1, "and", variable2) ] Also, if data is being appended to the end of … | |
hello I was just wondering if anyone knows of a site or someone (or start me off with some code) that could help me with learning about cascade menu's and changing them from a parent into a child, any help would be greatly appreciated. I am making the cascade menu … | |
For my extra credit, I'm supposed to generate the longest chain from 1-1000000, I wan't to know if it is correct..here is my code: the caller [CODE] start = 1 end = 1000000 longest, chain = -1, -1 #choiceX(start) for i in range((end-start)+1): if choiceX(start) > longest: longest=start chain=choiceX(start) start+=1 … | |
Hey people, i was just wondering if anyone knew the code to make a tkinter button... [CODE]def createExample(self): top=self.winfo_toplevel() top.rowconfigure(0, weight=1) top.columnconfigure(0, weight=1) self.rowconfigure(0, weight=1) self.columnconfigure(0, weight=1) self.Button = Button ( self, text=" Example", font=("Arial", 12), bg="white", fg="magenta", cursor="crosshair") self.Button.grid(row=1, column=0, sticky=N+E+S+W)[/CODE] ...and i wanted to know the code that … | |
Hello all! I was bored and upon my father's challenge I made a program that tells you the 20 day SMA for a specific date, I only have 100 days of data but can up that to over 8000 whenever I get my logic sorted out. The problem is I … |
The End.