15,175 Topics
| |
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 = … | |
How do I a add a copy and paste function in a Tkinter text widget? | |
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. … | |
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 … | |
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. … | |
| 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 … |
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 … | |
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 … | |
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 = … | |
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 … | |
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 … | |
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), … | |
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 … | |
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 … | |
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 … | |
[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 … | |
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 … | |
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] | |
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 … | |
Here is code which I wrote to experiment how hard it is to get Royal Flush in Poker. | |
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 … | |
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? | |
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 … | |
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... | |
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: … | |
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 … | |
How can I get error message? [CODE] try: ...# some operations except: sock.sendto(err_msg,0,addr) # send client err_msg from exception [/CODE] | |
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! | |
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) … |
The End.