15,190 Topics
![]() | |
Hi guys, I am trying to create a python chat server. So far, it has been going well but a problem has come up with threading. The threading for incoming connections works fine (in the listen_and_accept function). Since I would like to be able to type in commands in the … | |
Hi All, is there a trick in wxPython to skin application to look like this one? What are pros and cons if any? Take a look [URL="http://www.fileguru.com/images/b/audio_recording_studio_multimedia_sound_tools-5778.gif"]Here[/URL] Cheers :) | |
Hi all, Im trying to add tags to my blog post. i did it its done but i wanted more so when users click the link of tag, they will see other post tagged same. anyway here my view_tag function [CODE]def view_tag(request, tag_id): tag = Tag.objects.get(pk=tag_id) news = tag.pnews_set.all() return … | |
The function below is supposed to ask the user to enter a choice of rock paper or sciessors and output an error mesage if the user enters an invalid choice and then ouput a message if they won, drew or lost against the computer. [code] def rockPaperScissors(): import random choice=raw_input("please … | |
Hi Folks the game runs. jippie, but i have a small problem i cant get the board to get drawn from left to right, its drawn from upwards to downwards hope anyone can help me Sincerly elomanias | |
I'M reading the book "Python Programing second edition for the absolute beginner". While explaining the object paramater whithin a class, this how it reads. Base your class on [I]object[/I] , a fundamental, built-in type. Can someone please tell me what that means? Thanks. | |
Does anyone know where I can find a goo pdf python reference for the following? pre built constructors, functions/methods for the follwoing tuples, lists, dicts...etc I hate reading a book with nothing but quick explanation, I want to see them for myself. And I already know how to find them … | |
I'm having trouble understanding why I can't seem to access a dict object of a class once the class instance is referenced through a dict of instances. If that makes sense at all ;) I have a simple class containing only a dict called index. [CODE]class Node: def __init__(self): self.index … | |
I am writing a function that has two parameters F & L and the function returns the sum of the squares of all the intergers between F & L e.g if i call def sum(3,5) should output 50 (9 + 16 + 25) def sum(first,last): sqaure = i for i … | |
How do i stop the following thread? [CODE] from threading import Thread from scapy.all import sniff class SnifferThread(Thread): def __init__ (self,filter): Thread.__init__(self) self.filter = filter def run(self): sniff(filter=self.filter, prn=self.pkt_callback, store=0) def pkt_callback(self,pkt): print pkt.sprintf('%TCP.payload%') if __name__ == '__main__': sniffer = SnifferThread("tcp port 80") sniffer.start() #here i will make a GUI … | |
hi, Please could you help me with displaying the png image file I am saving. I want it to display just after it is saved so within the same function onPLOT [CODE]import wx import cx_Oracle import datetime import wx.grid import csv import numpy as np import matplotlib.pyplot as plt import … | |
[CODE]L = [ 0 , 2, 1 , -1 , -1 , -1, -1 ] for i in L: if i <= 0: L.pop ( i ) print L [/CODE] What I was expecting was that L = [ 0, 2, 1 ] but the result was [ 2 , … | |
Hello. This time it might be a bit more complicated. [CODE] def start_game(): global no_winner no_winner = True rows_cols() global board board = make_board() print_board() player_select() def rows_cols(): global rows global columns rows = int(raw_input('Height: ')) columns = int(raw_input('Width: ')) if rows < 4: rows = 4 if columns < … | |
hello, me again. When ever I try to add pictures it WONT LET ME ADD THEM. i download them, type all the code, and no image shows up at all. Can someone tell me how to correctly do it. do i have to define the code that imports pictures? | |
How do I center my text in python? I have a title and a description, and wan't to center it all in my output. | |
I wanted to try something seemingly easy, but I can't wrap my head around this. I want to open a .txt file, remove all dots from the text, and write the altered .txt as a new file. [CODE]#!python def process_file(): infile = open("dots.txt", "r") outfile = open("no_dots.txt", "w") for x … | |
I recently wrote a thread about help with classes. I got a lot of good responses but I am still struggling with more complicated stuff. I have an old project that I wrote a few weeks into learning python. I am now suppose to turn this project into a class. … | |
Well, I've written a simple program that gives you info about your computer. The program runs perfectly fine, but the console window pops up and really does nothing. So I would like to hide the console window and only show the gui frame. Pointers on how to do this? | |
This is a sample code I looked up. I am a rookie and I do not really understand it. [CODE]n = int(input('Enter an interger >= 0:')) fact = 1 for i in range(2,n+1): fact = fact*i print(str(n)+' factorial is '+ str(fact)) [/CODE] My biggest problems are: 1) for i in … | |
Hi all. I am very new at python and so i am having trouble with the simplest things, and i dont understand why this: newfile = raw_input('what do you want to name your new file?') text_file = open (newfile, "w") isn't working. Can somebody explain it? Thankyou | |
[CODE]import Tkinter class converter(Tkinter.Tk): def __init__(self,parent): Tkinter.Tk.__init__(self,parent) self.parent = parent self.initialize() def initialize(self): self.grid() self.labelVariable = Tkinter.IntVar() welcome = Tkinter.Label(self, textvariable=self.labelVariable, anchor="w", fg="black", bg="lightgrey") welcome.grid(column=0, row=0, columnspan=3, sticky='EW') self.labelVariable.set(u"Hello there. Welcome to MAKK's currency converter.") self.entryVariable = Tkinter.StringVar() self.entry = Tkinter.Entry(self,textvariable=self.entryVariable) self.entry.grid(column=0, row=1, sticky='EW') self.entry.bind("<Return>", self.OnPressEnter) self.entryVariable.set(u"Enter currency here.") money … | |
hello, i'm new to this website and well only have a few months of python exp. i decided to make a small, simple rather easy if HUMOR game. When is started, i did not know a whole lot other than how to make lists and scenes and make a way … | |
How could I call function by clicking in the graphics window. I currently have a draw eyes function but i want to be able to call it by clicking on the graphics window and call 30 eyes in the same colour sequence of blue, green and brown? so i could … | |
Hi y´all. I´m more than a little green at this and have been trying to get an understandig of Python. I came across WXPython and decided to try the first program in the tutorial by Fuze I´ve downloaded and installed python 2.6.3 and Wxpython 2.8.10.1. I´ve also got Python 3.1 … | |
These three things are holding me back. 1. The new style class object parameter - [CODE]class MyClass(object)[/CODE] [INDENT]Note that I'M also also not familir with the old style[/INDENT] 2. The [CODE]_init_([/CODE] - constructor, or any constructs for that matter. 3. The [CODE](self)[/CODE] parameter. How is it different from the normal … | |
Hi everybody, I'm trying to write a function that takes in 2 values, a min and a max, that prompts the user to enter a value within that range, and uses 0 as a sentinel to quit the loop. My issue is, I also want the loop to continue prompting … | |
Hi, I wrote this sample code to check the integrity of an IBAN (International Bank Account Number) bank account number. (See Wikipedia for further information) Any advice to simplify this? [code=python] # # IBAN_Check.py # Utility to check the integrity of an IBAN bank account No. # Python 2.5.1 # … | |
Why is it that if input 1, line 1 isn't deleted in a.txt? [code] x = open('a.txt','r') l = [] q = 0 for line in x: l.append(str(line)) b = "".join(l) print b a = raw_input("Which line do you want to delete?: ") l[int(a)] = "" x.close() x = open('a.txt','w') … ![]() | |
Hi, I am new to python programming. I am interested in writing a HTTP proxy using poll or twisted. I know how the tunnel works but I am not sure of starting the code. I need help from experts to complete the programming. As far as I know a tunnel … | |
I'm trying to make a tower defense game, i got all my tiles setup, but i need help with selecting a tower and placing it anywhere in the tile. This is an example of my tower class: class Missile(pygame.sprite.Sprite): def __init__(self): pygame.sprite.Sprite.__init__(self) self.cost = 100 self.selected = False self.image = … |
The End.