15,194 Topics
![]() | |
Hello, I'm using Java and Python together with Jython and I'm having trouble with some python syntax. I have a custom listener that I want to add to an object. Usually I'd do it like this: class ballCollisionListener(animation.CollisionListener): def collisionDetected(self,event): if event.getSource()==boundary: if ball.getX()<=0 or ball.getX()+ball.getWidth()>=boundary.getWidth(): ball.setXSpeed(-ball.getXSpeed()) elif ball.getY()<=0 or … | |
I was trying to write the output of a loop on a file. The problem is the writing repeats for each loop. [ICODE]prev_line = "" while line: Total = 0 fields = line.split() N = len(fields) name = fields[0] #sum each 5 fields over the raw: for step in range … | |
Hello I am quite new programming in Jython, I am working with DB. I a send SQL Statements, but I want to handle the zero rows in Resulset. rs = dataSource.performQuery(sqlstatement) rs.moveFirst() I dont know which condition has to be set when the Resulset doesnt has any row. When I … | |
I've gotten a little bit furter in understanding the general workings of python, and currently I'm fidgeting with classes and objects. I was thinking of the possibilities of having a program with a whole bunch of user defined classes that the user can use (hey, almost a repetitive aliteration there...) … | |
Hello!! I desperately need help on event triggering across panels in wxPython! :( I have 2 classes that inherit wx.Panel: Leftpanel & Rightpanel Leftpanel consists of several buttons. Rightpanel consists of a graph (i.e. using matplotlib). I want to make the program so that pressing the button on Leftpanel will … | |
Hello All, Greetings!! I was thinking of making MP3 Encoder. This is because I cannot find Exact encoder so I was finding some bindings for Lame Mp3 encoder and CD extractor/any cd to wav Library Thanks all Steve | |
First of all, I'm a total beginner which is the reason that probably my code contains a few simple and dumb mistakes...but how you see I'm working on it ;) My task is to write a program that contains a queue which will be returned in reversed order. But my … | |
Hi, I have set up a basic HTTP server, using code similar to that on [url]http://fragments.turtlemeat.com/pythonwebserver.php[/url]. I have created a BaseHTTPRequestHandler, and modified the do_GET function. This server is linked to a FLEX GUI, which requires a crossdomain.xml file in order to get data from another domain. If the server … | |
I want to subclass a python dictionary to create a new class with dynamic keys. In other words the key value is 'property(fset, fget, fdel, doc)'. For some reason the when I get the d['b'] key, a property object is return instead of the function get_b. d['b'] should return the … | |
Hi there. Iv been searching (this forum and Google) for examples using the StyledTextCtrl, so that I can see how the thing actually works, but with no real joy. Iv found a couple of very basic examples but nothing that really shows the workings of the control. Iv seen the … | |
I have this assignment where I write certain lines from an input file. These lines I'm looking for in this case is only identified by its following line ("EOL"). It goes like (shortened): [CODE]while True: line = infile.readlines() if not line: break linesplit = line.split(",") line = line[:-1] if line … | |
hi all, glad I found this site. I hope you all can help me out with this little problem. First, my environment: Mac OSX 10.5.5 Python 2.6 (compiled from source, not using macports) basedir: /usr/local/bin/python; /usr/local/lib/python2.6 Following the proper directions on how to install setuptools (from here [url]http://pypi.python.org/pypi/setuptools#cygwin-mac-os-x-linux-other[/url]) [code] bash-3.2# … | |
Here I am again with new problem. I want to do some calculation on each field row after row. The for loop which I tried is not giving me what I expected [ICODE]#sum each 5 fields over the raw: for step in range (6, N, 5): for i in range … | |
Hi, I need to write a partial ocr for just 2 characters but I don't know where to start. The 2 chars are '8' and 'F'. The 8 is only comprised of two arcs and the F is one vertical stroke and 2 horizontal strokes. I cannot use pytesser for … | |
everything works fine on my app until I add a menu. Every button every field, everything ends up stacked in the top left corner. as soon as I set the menubar to the main frame and run it collapses. I have like 5 sizers that get added to a final … | |
Hi everyone, I am working on a checkbook balancer for school and my code looks like this: [B]def process(balance): trans_type= raw_input("Enter Deposit(d), withdrawal(w), print(p), or quit(q):") amount=input("Enter the amount:") if amount<0: print"You've entered an invalid number." if trans_type=="d": balance=int(balance)+int(amount) print"Your current balance is", balance elif trans_type=="w": balance=int(balance)-int(amount) print"Your current balance … | |
Hello, I'm trying to make a stereovision application using opencv. Thus I have to stream video from two webcams. My questions are: -How do open the two streams in a wx.Frame...I suppose I must have some form of container -How do I convert from a captured cvFrame to a wx.Image … | |
I have written a script that scrapes a particular website and returns the date of an article, description and url. I want to display this information on the console with clickable text so that when I click on text/link called "site" it will open the url of the article in … | |
I have a small WxPython app using the CalendarCtrl module, which works fine. I have it set to bring up a grid of times for a particular day's appointments when I click on one of the days. But I don't see how to detect which cell of a grid I … | |
Hey guys, I've got a fairly simple script which I'd like to convert (if possible) into a Windows DLL so that I may use it in conjunction with some of my .net projects. Is such a feat possible, if so where do I begin? I've read that there's a book … | |
Hey guys, I'm fairly novice at Python so I hope my question isn't too mundane for you all. I've been doing some research into creating Windows Services with Python and came across some useful information with regard to creating one. I've managed to register the service - my problem lies … | |
Hi all, How can I declare a global variable inside a module and use it across other modules for throughout the lifecycle of the program? Regards, Dinil | |
Greetings: I have [ XRced version 0.2.0-5 ] installed. Please, what about [ XRCWidgets-0.1.7.win32.exe ] : Is this different, more, or less, than what I have installed ? Thanks! | |
Greetings: The following files are all *.file . This seems wrong. They all contain similar to this: #!/usr/bin/env python from wx.tools.XRCed.xrced import main main() What are they, and can I rename to: *.py or *.pyw ? C:\Python\Scripts\ ================= editra.File helpviewer.File img2py.File pyalacarte.File pyalamode.File pycrust.File pyshell.File pywrap.File pywxrc.File xrced.File Thanks! | |
Hi all, This is my first thread on Daniweb!. I was wondering if someone would help nudge me in the right direction on this one. I'm new to python, been using it for about 6 months or so trying to develop a network simulator for school. This is not an … | |
hello everyone! i need help a bit ... //// County/Region 2007Q3 2008Q3 Yr/Yr% Los Angeles 13,583 17,073 25.70% Orange 3,882 5,692 46.60% San Diego 5,673 7,062 24.50% Riverside 9,250 11,714 26.60% San Bernardino 7,038 9,110 29.40% Ventura 1,377 1,676 21.70% Imperial 259 568 119.30% San Francisco 252 353 40.10% //// … | |
Hello- I do not have much experience with python, although I am trying to write a script to do the following: I have more than one CSV file, in this example I have three, each file has many rows, and two columns, they are in this format: Column 1 is … | |
Please, how does 'Python, wxPython, wxWidgets, C++' all fit together? WxWidgets being written in C++ and all. What is actually being handed to Python when we use these things. Thanks a bunch! | |
Hi. I need to have two frames (not necessarily visible together and possibly more than two), and I need to be able to interact between them. For example - if I have two frames, one visible and one not visible. Clicking a button on frame1 will make frame1 invisible and … | |
I am fairly new to Python, so writing code in it is complicated right now. I wanted to know if anyone knew of a code to send a process started on a workstation to a multiprocessor supercomputer where the job could be finished while still allowing the workstation to be … | |
Hi there. I am using a RichTextCtrl on a window with a toolbar. The toolbar has a save button on it that is disabled by default when the application starts. I need this button to become enabled when the user changes something in the RichTextCtrl, but I'm having trouble working … | |
I am trying to run the following screen scraping script but it's not displaying any output. Can someone tell me what I'm doing wrong? [CODE=python] from BeautifulSoup import BeautifulSoup import urllib url = 'http://toronto.en.craigslist.ca/search/cta?query=civic&minAsk=min&maxAsk=max' doc = urllib.urlopen(url).read() soup = BeautifulSoup(doc) tags = soup.findAll('p') for tag in tags: addate = tag.contents[0] … | |
Hi, I have a python script which uses a COM object. This script works correctly when I run it from pywin, however, it does not run when I run it from windows command line - it throws an exception occurred in this COM object. I know that this COM obj. … | |
Hi all, Im making a test text game and i got this error when i was trying to run it, after i had told it i wanted to attack: [code=python] Traceback (most recent call last): File "/home/tom/Desktop/Python/Text game/main.py", line 109, in <module> main() File "/home/tom/Desktop/Python/Text game/main.py", line 105, in main … | |
how do i create a simple interface with two buttons and a picture in the backgroud in python | |
Hi All, I'm extremely new to Python and would like to create a program to help automate some of the things I do at work. I need to take information from an IDX shell and create a word document with it. Does this sound possible? Would anyone be interested in … | |
Hi all I was wondering if someone can let me know of a quick and easy way of interacting with a Javascript control on a web page. "<a href="#p189191" name="option66" onclick="selectPollOption(66);" class="vote">Vote</a>" That's the control I would like to activate, I was thinking I could use a regular expression to … | |
[CODE]#!/usr/bin/python # e begoli, python connector for mysql # import MySQL module import MySQLdb # connect db = MySQLdb.connect(host = "localhost", user = "adamplo1", passwd = "U7RJM5HQ", db = "adamplo1_UniProject") # create a database cursor cursor = db.cursor() # execute SQL select statement cursor.execute("SELECT * FROM User") # get the … | |
Alright this is my first program in python, so be gentle. I have 2 files I need to basically combine to create a record in mysql. Features.txt has around 1300 records and property.txt has about 25,000 records. I can read in property.txt fine and get my insert statements. My problem … | |
I am trying to send a message using SOAP. Everything seems to work but no message comes through. I get no error message at all here is my code [CODE]#!/usr/bin/python from SOAPpy import WSDL print "Content-type: text/html\n" wsdlFile = 'http://www.adamplowman.com/sendservice.wsdl' server = WSDL.Proxy(wsdlFile) username = 'adamplowman' password = 'DreamOn' destination … | |
Hi, just beginning to learn Python, and am trying to create a script that will output matches from a text file to a user's input, I have managed that so far, the problem I have is trying to have something returned if the user puts in a string of text … | |
I am fairly new to Python and trying towork on this problem. I want to split the file which contains two seuqence of letters by the blank line that separates them then 'compare' them: What you need to do: Text file genesequences.txt contains two gene sequences, separated from each other … | |
Hello, I am reading this turorial [url]http://diveintopython.org/soap_web_services/introspection.html[/url] and i am trying to echo out all my wsdl method. I am trying to do this on my external web hosting server. I have got the modules installed but i am getting an internal server error [url]http://adamplowman.com/cgi-bin/test_xml.py[/url] here is the code [CODE] … | |
First off, I know that to set an indexed variable, say, mylist[3] = "Hello". I also know that you wouldn't be able to set mylist[3] if you didn't first state: [code = python]mylist = ["Whatever", "Whatever", "Whatever", "Whatever"][/code] But, if you had a variable with an extremely large index, it … | |
I can't really seem to find a jython forum and this question is somewhere between a jython and a python question. I'm trying to get a java Scanner in python. So in java I say myInterpretter.exec("import java.util") and then in python I try and access jav.util.Scanner but it says java … | |
Hi there. I started with wxPython (Under Linux) a little while ago and I'm enjoying very much, however, there doesn't seem to be a control for working with Rich text. Iv found a few articles (mostly dated a few years ago) that suggest that such a control is on its … | |
Hi, I am trying to run a python(2.5.1) script on apache2. Basically, I want that when I run this script in the browser on the web server, a gnome windows pops up. The code is as follows: [code] import subprocess def launchExplorer(): path = '/home/robot/Music' command = ["/usr/bin/gnome-open",path] subprocess.call(command) if … | |
I am creating a tetris-like game. I have decided to use coordinates (x,y) along with a dictionary. Here is a part of the dictionary: [CODE=Python] gameTable = {(-5,10):0,(-4,10):0,(-3,10):0,(-2,10):0,(-1,10):0,(0,10):0, (1,10):0, (2,10):0, (3,10):0, (4,10):0, (5,10):0, (-5,9):0, (-4,9):0, (-3,9):0, (-2,9):0, (-1,9):0, (0,9):0, (1,9):0, (2,9):0, (3,9):0, (4,9):0, (5,9):0, (-5,8):0, (-4,8):0, (-3,8):0, (-2,8):0, (-1,8):0, (0,8):0, … | |
I am a bigginer in python and even programming. I want to use python in my thesis for reading and writing large size data. I have a little sample of code which access which runs over the lines and reads each element on a line. [ICODE]def get_site_only(pat): newpat = "" … | |
Hi everyone, I have been fiddling around with a speech recognition program for a while now and i always had something that bothered me. Here is my code i have been using. It is the example code from code.activestate.com [code=python] from win32com.client import constants import win32com.client import pythoncom """Sample code … |
The End.