15,181 Topics

Member Avatar for
Member Avatar for kapcom01

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 …

Member Avatar for kapcom01
0
1K
Member Avatar for hdk

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 …

Member Avatar for hdk
0
996
Member Avatar for The Champ

[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 , …

Member Avatar for snippsat
0
125
Member Avatar for sentinel123

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 < …

Member Avatar for sentinel123
0
313
Member Avatar for python user

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?

Member Avatar for vegaseat
0
110
Member Avatar for persianprez

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.

Member Avatar for Stefano Mtangoo
0
105
Member Avatar for Yeen

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 …

Member Avatar for Stefano Mtangoo
0
3K
Member Avatar for A_Dubbs

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. …

0
81
Member Avatar for AutoPython

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?

Member Avatar for sheeps
0
14K
Member Avatar for jwxie

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 …

Member Avatar for vegaseat
0
78
Member Avatar for Fetch

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

Member Avatar for vegaseat
0
93
Member Avatar for kjpadilla

[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 …

Member Avatar for kjpadilla
0
880
Member Avatar for python user

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 …

Member Avatar for python user
0
178
Member Avatar for gangster88

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 …

Member Avatar for vegaseat
0
154
Member Avatar for Polar67

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 …

Member Avatar for vegaseat
0
87
Member Avatar for lewashby

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 …

Member Avatar for vegaseat
0
82
Member Avatar for MRWIGGLES

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 …

Member Avatar for pythopian
0
103
Member Avatar for J-M DESMETTRE

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 # …

Member Avatar for orinbai
0
3K
Member Avatar for nevets04

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') …

Member Avatar for leegeorg07
0
86
Member Avatar for whimsical1987

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 …

0
58
Member Avatar for bisfrim

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 = …

0
48
Member Avatar for nizbit

I need to parse an assembly program. I have no problems parsing a group of instructions or a group of instructions with one loop. For example: [CODE] LD R2, 0(R1) DADD R4, R2, R3 SD 0(R1), R4 DADDI R1, R1, #-8 DADD R2, R2, R4 or Loop: LD R2, 0(R1) …

Member Avatar for nizbit
0
127
Member Avatar for Aiban

Hey Everyone. I'm back. I started a Python project that actually got close to completion back about six months ago. Most times when i requested help i was often suggested that i don't use v3 of python as many things changed (someones help code was for 2.x and didn't work) …

Member Avatar for lllllIllIlllI
0
90
Member Avatar for jaison2

I want to be able to draw an eye for a colour inputted by the user. If the user enters the colour green,brown or blue then the eye should be drwan orelse an error message saying "not a valid colour" should be outputted [code] from graphics import * def drawCircle(win, …

Member Avatar for Kobrakai
0
223
Member Avatar for Aiban

I'll keep this simple for now Can a windows (7) gadget be made with python or does some microsoft type development kit need to be used? Thanks

Member Avatar for vegaseat
0
77
Member Avatar for mahela007

Say I've written a function that will take an unlimited number of arguments and store them under different variables. Since the use is able to input any number of strings, it's not possible to give names to all the variables that might be created. So, how would I create variables …

Member Avatar for mahela007
0
107
Member Avatar for sentinel123

Hello. Here I go again. I tried to create a computer enemy for my connect 4 game: [CODE] def turn_comp(): import random print 'Computer ist am Zug!' playchip = random.randint(0, columns) board[0][playchip] = 'O' print_board() [/CODE] Even though I limited the range of randint with 0 and columns (in a …

Member Avatar for pythopian
0
148
Member Avatar for sentinel123

Hello. Here I am again with my Connect 4 project and another board problem. This is my code: [CODE] fielda = [] fieldb = [] rows = int(raw_input('Height: ')) columns = int(raw_input('Width: ')) if rows < 4: rows = 4 if columns < 4: columns = 4 def print_board(): for …

Member Avatar for sentinel123
0
130
Member Avatar for gangster88

I want to be able to move the iris and the pupil of the eye, if I click on the left of the graphic window irrsepective of high or low then it should move left and if i click on the right then if should move right. if i click …

0
80
Member Avatar for krishna_sicsr

Hi, While running my Python Script I am getting "org.python.core.PyInstance" ERROR. I am not getting why this ERROR is coming. Please help......

Member Avatar for jlm699
0
82

The End.