14,949 Topics

Member Avatar for
Member Avatar for Naynah

I'm stuck on the fifth stage of my assignment, the question is; 'Add in code to the key-press event handler so that the 'person' is constrained to move within the array and cant' walk through a wall.' I'm not sure how i'm supposed to update the curindex, i really need …

Member Avatar for TrustyTony
0
210
Member Avatar for freddypyther

Hi! I've searching for python IDE's and I've not found anything like NetBeans for java. I downloaded Dr Python but was too simple, I tried to install PyDev on Eclipse but I got some errors. I saw some screenshots about SPE and I said whoa! that seems good, but I …

Member Avatar for brandonrunyon
0
981
Member Avatar for Tarkenfire

Alright, making a dice roller...because I need a dice roller. Anywho, in the process of testing it came across an exception that I can't figure out how to remedy. The exception gets thrown at line 33 below: Source code: [CODE]import random #PUT FAILSAFES IN THIS FUNCTION. #gets dice information def …

Member Avatar for Tarkenfire
0
171
Member Avatar for ihatehippies

I've been using the Aspects module to trace and patch routines on the fly in my wxPython app. The problem I've run in to occurs when wx binds an event to a function. ie: an event is binded to function <function func at 0x03969A30> after aspects.with_wrap() func now becomes <function …

0
134
Member Avatar for koti86
Member Avatar for toll_booth

I'm trying to program Tic-tac-toe. When I run my program, the X's and O's pop up in all sorts of strange locations, and they don't "settle" into their proper positions until the very last move of the game. Here is my code: [code]'''Tic-tac-toe. ''' from Tkinter import * SQU_SIZE = …

Member Avatar for toll_booth
-1
136
Member Avatar for ryufire
Member Avatar for vegaseat
0
124
Member Avatar for theraven82

Hi, I have a for-loop, and in each iteration I have to open a dos-command. I use the subprocess module for this: [code=python] fid1=open("test.txt", 'w') p=subprocess.Popen(args, stdout=fid1, stderr=subprocess.STDOUT, shell=True) fid1.close() [/code] The output of the dos-command is written to the txt-file, but I still need to terminate the process p. …

0
105
Member Avatar for XR_

Hi, i'm searching for a way to know the hostname of a machine connected to my twisted-server. I use to know the host the method self.transport.getPeer().host, and i have the IP in this way. But i need to know the hostname. I'm searching for a way like socket.gethostname(). Waiting your …

Member Avatar for Beat_Slayer
0
413
Member Avatar for ShadyTyrant

Recently I have been writing my own Python editor for fun. I have came pretty far but now I have some issues. My editor object is in my notebook but wont go to the bottom of my window. I can get it to expand across the screen but not down. …

Member Avatar for ShadyTyrant
0
100
Member Avatar for jtaylor-bye

Hi all this is my code :- [CODE]import pygame from pygame.locals import * from sys import exit from random import * pygame.init() screen = pygame.display.set_mode((640, 480), 0, 32) while True: for event in pygame.event.get(): if event.type == QUIT: exit() screen.lock() for count in range(10): random_color = (randint(0,255), randint(0,255), randint(0,255)) random_pos …

Member Avatar for redyugi
0
3K
Member Avatar for python_user

Hi guys, i have a problem here i have a situation where i need to save all the images opened using PIL I have no idea how to do without displaying images on screen one by one and saving them Can anyone please help how to save them without switching …

Member Avatar for python_user
0
5K
Member Avatar for doffing81

What do I need to do to make rules for user input? Say I want the user to choose a number 1-5. If they pick one, I want to go to the next step. If they don't I want to tell them that they have to pick a number between …

Member Avatar for snippsat
0
97
Member Avatar for acrocephalus

Hello, I have written this code, deleting those parts which are no needed to reproduce the error: [CODE]#! /usr/bin/env python # TestDialogs.py import wx, MySQLdb, wx.lib.intctrl, wx.grid ID_SPECIES=1 class SearchDlg(wx.Dialog): def __init__(self): wx.Dialog.__init__(self, None, -1, 'Search species', size=(400,400)) panel = wx.Panel(self, -1) vbox = wx.BoxSizer(wx.VERTICAL) hbox1 = wx.BoxSizer(wx.HORIZONTAL) hbox2 = …

Member Avatar for acrocephalus
0
229
Member Avatar for acrocephalus

Hello! I have designed a dialog that shows a wx.Grid with some data (full code at the end). Then, there is a search area. The other buttons are not working now. When you fill any search control with some data shown on the grid, it prints the index where the …

Member Avatar for acrocephalus
0
715
Member Avatar for dustbunny000

Hi I am VERY new to python. I am trying to write a function that returns lines from a text file to a new file. I can't seem to get it right. So far my code looks like this: [CODE]def seperate_atoms(f):#Enter .pdb file in with quotations myfile=open(f,'r') crudepdb=myfile.readlines() cleanpdb=[] for …

Member Avatar for Beat_Slayer
0
145
Member Avatar for mjs051

I'm currently learning Python, and at the moment I'm writing a simple grocery list program. At one point in the program, the user is asked how many items are on their shopping list. What I want to do is take the number that the user inputs (lets say it's 5), …

Member Avatar for TrustyTony
0
9K
Member Avatar for simpatar

Here's the problem. I'm using pythons re-functions. I'm supposed to make a re-function to check if a string ends with 3 numbers(or more) before the extension.(e.g. 123.txt, 93821.ini) Here's my code that's supposed to do the magic [code] re.search('[0-9][0-9][0-9]\.','1234.txt') [/code] now, this doesn't work out. And I have no clue …

Member Avatar for simpatar
0
114
Member Avatar for Kruptein

Hey I've released the first alpha of a project of me called Minimal-D It's meant to combine at least 3-development aspects: -text-editing -file browsing -ftp uploading/downloading (-sql) I combine these three in a simple,lightweight and small program and I want to know what you think about it... You can see …

0
72
Member Avatar for lewashby

I'M reading the book "Beginning Game Development with Python and Pygame". The book showed me how to calculate the distance between two points using vectors. It first explained that you just subtract the values in the first point from the second. But just page or two pages later it says …

Member Avatar for Beat_Slayer
0
87
Member Avatar for lewashby

[CODE]class Vector2(object): def __init__(self, x= 0.0, y = 0.0): self.x = x self.y = y def __str__(self): return "(%s, %s)" % (self.x, self.y) @classmethod def from_points(cls, P1, P2): return cls( P2[0] - P1[0], P2[1] - P1[1] ) A = (10.0, 20.0) B = (30.0, 35.0) AB = Vector2.from_points(A, B) print …

Member Avatar for Beat_Slayer
0
105
Member Avatar for viandante

Hi guys! I'm writing my first small application*. For this I'm using Sqlite as database, Glade as GUI builder and Python as coding. The application is pretty simple: it's a notebook to store names, surnames, adresses, etc.. I've been able to create a first window to store data in Sqlite …

Member Avatar for woooee
0
869
Member Avatar for D33wakar

using wx python.got black bars instead of unicode characters in gui window. [hint]:My interpreter gives error- [COLOR="Red"]Unsupported characters in input[/COLOR]

0
77
Member Avatar for awie10007

Scanning from a laser line and usb cam V Python fill up memory to 1.6G and crash the system Smaller Scan works fine is there a better plotting module or a way of getting past V Python memory block? The plot must happen in color xyz rgb. [CODE]import thread import …

0
199
Member Avatar for TrustyTony
Member Avatar for TrustyTony
0
581
Member Avatar for gunneronaspooky

Trying to get a program to fine the slope and intercept of a line on a graph.... I've got it all working so far...except the last line. I broke it down into pieces and ran it assigning numbers to the variables, but in the program, it doesn't work. Here is …

Member Avatar for IsharaComix
0
168
Member Avatar for -ordi-

Best way to parse this webpage private info: [url]https://ee.ekool.eu/index_et.html?r=2#/?screenId=g.user.login&err=1[/url] I found Beautiful soap and PyKhtml. What is the better?

Member Avatar for -ordi-
0
529
Member Avatar for Sargasso

I am currently trying to take two columns from a *.csv file... log10 transform them, and then plot them up on a graph. The graph is not the issue, I just need to edit those two columns and plot them. The file does have a header row, there are 8 …

Member Avatar for Beat_Slayer
0
124
Member Avatar for pythonstudent

Hey everyone, I am just starting to learn iteration in Python. I am stuck on an assignment that my teacher gave me. I am supposed to make a code to display this: 1 -2 3 -4 5 -6 7 -8 So far my code is this: counter=8 number=9 while counter>0: …

Member Avatar for cghtkh
0
101
Member Avatar for _neo_

How can I get results from exec()? Any suggestions appreciated!!! [CODE] #!/usr/bin/python import socket sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) host = socket.gethostname() port = 1234 sock.bind((host,port)) while True: cmd, addr = sock.recvfrom(1024) if len(cmd) > 0: print("Received ", cmd, " command from ", addr) exec(cmd) # here how I can get …

Member Avatar for _neo_
0
4K

The End.