14,952 Topics

Member Avatar for
Member Avatar for butcher71793

i am making a game in python 2.3.5 and i wanted to know if there is a command that would make it so one sprite will move to another no matter what the position is on the screen.

Member Avatar for Firewolf
0
164
Member Avatar for charlottetemp

Hello. I am stuck on a simple piece of code. For some reason it keeps saying it can't call the Str object. Im also unsure on how to float the data to 2 decimal points (i don't know where the 2.f% should go.) The task is to make a taxi …

Member Avatar for charlottetemp
0
7K
Member Avatar for selimhanov

Hi, It must be a simple issue, but couldn't find any answer googling. Here is the problem: I have a simple test application with a TextCtrl, Button and StaticText. When I press the Button, it must query PostgreSQL with ...[code]SELECT name FROM contacts WHERE name LIKE '%"+TextCtrl.Value+"%'[/code] and return the …

Member Avatar for Pupo
0
153
Member Avatar for ewall

I've been working on a simple little PyGTK app that shows an icon in the system tray. When you right-click, the pop-up menu appears as expected. However, first the menu appears with just some up and down scroll arrows, and I have to scroll down before it fills in and …

Member Avatar for ewall
0
209
Member Avatar for gangster88

how could i print the length of a parameter?.. like def length(word) gives the output "word 4"?.. I have no clue of what to do? def length(): len=length()

Member Avatar for vegaseat
0
116
Member Avatar for punter999

[CODE]import wx class McaMenu(wx.Frame): def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, id, title, size=(640, 432)) menubar = wx.MenuBar() file = wx.Menu() new = wx.MenuItem(file, 1, '&New\tCtrl+N', 'Creates a new document') file.AppendItem(new) file.AppendSeparator() open = wx.MenuItem(file, 2, '&Open\tCtrl+O', 'Open New document') file.AppendItem(open) save = wx.MenuItem(file, 3, '&Save\tCtrl+S', 'Save') file.AppendItem(save) save = …

Member Avatar for Namibnat
0
166
Member Avatar for gangster88

How could i index the program to output e.g. displayDate(10, 2, 2009) gives "10 Feb 2009" as the output. [code] def displayDate(day, month, year): Months = ['Jan', 'Feb', 'March', 'April', 'May', 'June', 'July', 'August', 'Sept', 'October', 'December'] [/code]

Member Avatar for vegaseat
0
101
Member Avatar for kbalamuk

I have a string as such: str = 'C:\Process new\RF\test.dat' I need to replace all the backslashes with '/': res = 'C:/Process new/RF/test.dat' It is NOT a straight forward search and replace as I need to replace escape sequence (\). Any ideas?

Member Avatar for slate
0
9K
Member Avatar for personx121232

hi there,i have installed win32all package for python 2.5 , but now the python IDLE does not load any more...whats the problem,thanks.

Member Avatar for Stefano Mtangoo
0
86
Member Avatar for spogs

When I do the following: [code] s= serial.Serial('/dev/',9600) # or set a function and pass via command line s= serial.Serial(arg1,9600) [/code] The code executes without any error. [b]But[/b], when I use AJAX and POST the parameters to the script [code] def index(req): info = req.form sys.stderr = sys.stdout s= serial.Serial(info['device'],9600) …

Member Avatar for spogs
0
113
Member Avatar for snake03

Hi I am new to python and am learning how to use tkinter. I am creating a game and need to create callbacks for the buttons so the game has a cell location when a player clicks on the corresponding button. I am unsure on how to do this, hope …

Member Avatar for vegaseat
0
96
Member Avatar for gunbuster363

Hi, I am new to here. I am doing with my honours project in University, it is about data mining. Before I can do data mining, first I need data. I want to extract data from a site : [url]www.tripadvisor.com[/url] Should I write my web crawler with python? I don't …

Member Avatar for gunbuster363
0
440
Member Avatar for Godflesh

How can you check the length of a file / list and then use the value in an "if-loop" in python? I want to create a "if-sats" that must check the amount of elements(numbers) in a textfile, if the amount is less then 5 do this... else do that..

Member Avatar for Godflesh
0
97
Member Avatar for danibootstrap

Hi, The following is a GPS string: $GPGGA,092204.999,4250.5589,S,14718.5084,E,1,12,24.4,89.6,M,,,0000*1F $GPGSA,093345.679,4234.7899,N,11344.2567,W,3,02,24.5,1000.23,M,,,0000*1F $GPGSV,044584.936,1276.5539,N,88734.1543,E,2,04,33.5,600.323,M,,,*00 $GPRMC,199304.973,3248.7780,N,11355.7832,W,1,06,02.2,25722.5,M,,,*00 $GPVTG,066487.954,4572.0089,S,45572.3345,W,3,09,15.0,35000.00,M,,,*1F I want to extract the line following and including $GPGGAand $GPRMC.The GPS string length is variable.Please let me know how to do this and store each of them into a single string or 2 separate strings. thanks in …

Member Avatar for slate
0
114
Member Avatar for fuston05

making for practice a temp converter. i got the basic program to convert C to F. heres that part: C = input("what temperature (celius) do you need converted? ") print "%s degrees celsius is equal to %s degrees Farenheit" % (C, 32+(212-32) / 100.0 * C now im trying to …

Member Avatar for fuston05
0
151
Member Avatar for punter999

import wx class McaMenu(wx.Frame): def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, id, title, size=(640, 432)) menubar = wx.MenuBar() file = wx.Menu() new = wx.MenuItem(file, 1, '&New\tCtrl+N', 'Creates a new document') file.AppendItem(new) file.AppendSeparator() open = wx.MenuItem(file, 2, '&Open\tCtrl+O', 'Open New document') file.AppendItem(open) save = wx.MenuItem(file, 3, '&Save\tCtrl+S', 'Save') file.AppendItem(save) save = …

Member Avatar for Namibnat
0
107
Member Avatar for Godflesh

Hello! I have some probs with this code, somehow it dont loop 10 times as it should, just one? How do i make python use a testfil.txt that already exist? I dont want to remove the old data in the file just add new data to it? In this code, …

Member Avatar for Godflesh
0
82
Member Avatar for Cornholio

Hi, I have jest started learning Python. I would like to get some help on writing a script that would delete a set number of lines from a text file which looks like this : 1846440556 1846440521 1846440491 1846440505 1846441137 1846441102 1846441080 1846441331 1846441323 1846441315 ... ... Thanks in advance …

Member Avatar for Godflesh
0
26K
Member Avatar for lrh9

And I can't get anything I write to work. I'm so far off course I think I just need a working example of import hooks in action. I've looked for examples on the Internet, but they only show what looks like correct code. They never show that code in action. …

Member Avatar for lrh9
0
345
Member Avatar for digitaldust

Hi everybody, I would like to implement a task but I'm not sure the best way to do it. I have some objects each of which has an attribute that represent the object coordinates as a tuple. I would like to find the neighbors of each object, that is the …

Member Avatar for woooee
0
143
Member Avatar for greatkraw

why do I only end up with one object in the list i want to keep appending I am sure the answer is simple, thanks studRoll = [] def GetInteger(i): try: return int(i) except: return 0 class stud: def __init__(self, a, n, m): self.age = a self.name = n self.mark …

Member Avatar for woooee
0
106
Member Avatar for kbalamuk

How do I access windows environment variables using Python? eg. if I have the following: set junk=C:\temp\junk how do I access 'junk' from python?

Member Avatar for AutoPython
0
94
Member Avatar for voolvif

Hi, I'm trying to parse an apache log file and match the IP addresses in it. This is my code so far: [CODE] import re ippattern = re.compile(r"\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b") def matchmyip(): if ippattern.search(line): matchedip = ippattern.search(line) print matchedip.group() [/CODE] Now given a line like this from a log file: [CODE]1999-08-01 00:00:00 …

Member Avatar for voolvif
0
3K
Member Avatar for lrh9

(A quine is a program that produces its own source as its output, typically to a file.) [CODE=Python]import sys ifile = sys.argv[0] counter = 0 istream = open(ifile) source = istream.readlines() source[2] = 'counter = ' + str(counter + 1) + '\n' if counter == 0: original = str(ifile) source.insert(5, …

Member Avatar for dwks
0
160
Member Avatar for i_saw_some

Hi, I used SCons to create a shared library (dll) from a c++ file (hello.cpp) below. Then I used Python and it ctypes library to load in the dll and call its functions. I can load the dll and call the main function, but nothing else. I cannot call the …

Member Avatar for annu7uch
0
2K
Member Avatar for hopefullin

Hello, I need some help with python GUI. There are one image(image1), two plots(plot1, plot2) in the GUI. I want they share the same axes. I tried with many methods but only found that just one axis is shared. Another problem is the image and plot redraw flicker. How to …

Member Avatar for hopefullin
0
403
Member Avatar for explorepython

Hello all, I want to display a hyperlink in qt. For this i need to display the link for the url (as underlined text). I can achieve it easily using style sheets and the url can be opened with webbrowser module.. I want to get the clicked signal of the …

Member Avatar for explorepython
0
728
Member Avatar for zrin

Hi! I am working on another program, this time it's a guessing game. I have spend so many hours late in the night, but i can't figure out how to fix this problem. I won't the program to read the input number and display if it is bigger, smaller or …

Member Avatar for zrin
0
105
Member Avatar for bryancan

I have to try and echo something to a file from python, but because fot eh content of what I want to write to this file, I seem to not be getting all of what I want into the file. Here is what I WANT to echo to a file: …

Member Avatar for woooee
0
105
Member Avatar for Dokino

hello, when I was writing length converter I came across this problem while statement(bold one) gives me Indentation Error that says "unindent does not match any outer indentation level" and I was wondering why's that? Could anyone suggest me how to fix it [code=python]def leng(): def milimetrai(): while True: try: …

Member Avatar for Dokino
0
126

The End.