15,175 Topics

Member Avatar for
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
126
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
415
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
101
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
239
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
719
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
106
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
877
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
201
Member Avatar for TrustyTony
Member Avatar for TrustyTony
0
591
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
530
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
125
Member Avatar for Alex Sarria

Hi, everybody! My name is Alex and I'm programming in C++ and Python just for hobby. My main interest is about games, fractal and fractal music. So, by the moment, I have a personal project with sounds by mean Python. I apologize, my English is not good...

0
30
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
103
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
Member Avatar for _neo_

How can I get error message? [CODE] try: ...# some operations except: sock.sendto(err_msg,0,addr) # send client err_msg from exception [/CODE]

Member Avatar for _neo_
0
268
Member Avatar for Wumbate

Hi, I just finished a Python UI app with Tkinter and want to make it runnable by double-clicking an application on Mac OS X. But I'm having trouble figuring out how to do it. Does anyone have any instructions they could point me to? Thanks!

Member Avatar for Beat_Slayer
0
55
Member Avatar for Ghostenshell

I need to check for floating point numbers inside my class but it doesn't seem to be working. Any suggestions? [CODE] class Rectangle: def __init__(self, length = 1, width = 1): self.__length = length self.__width = width ##Setters to float def set_length(self, length): self.__length = float(length) try: #self.__length = float(length) …

Member Avatar for Ghostenshell
0
216

The End.