15,181 Topics

Member Avatar for
Member Avatar for sneek

Hello, I've read the python doc (C-API) and was wondering about the two reasons to extend python with C. The first reason is to implement new build-in object types and the second one is to call C-Library functions and system calls. Ok, I think i got the second one but …

Member Avatar for pythopian
0
135
Member Avatar for sravan953

Hey All, I have some code here, the problem is in line 82-83: [code='python'] import smtplib import wx window=wx.App() class pymailer(wx.Frame): def __init__(self): wx.Frame.__init__(self,None,-1,"Py-mailer",size=(500,700)) try: self.s=smtplib.SMTP("smtp.gmail.com",587) self.s.starttls() except: wx.MessageBox("Error 001: Could not connect to the internet, please try again later.","Internet Connection Error") self.panel=wx.Panel(self,-1) menubar=wx.MenuBar() filem=wx.Menu() filem.Append(201,"Quit") self.Bind(wx.EVT_MENU,self.Quit,id=201) viewm=wx.Menu() viewm.Append(202,"About") self.Bind(wx.EVT_MENU,self.About,id=202) …

Member Avatar for pythopian
0
612
Member Avatar for shaan07

Hei..i am novice to programming. How to generate beautiful html pages from a text file. My idea is to generate XML first and then generate it to html. Generated html page should contain all the information that the text file contains..like tables,pics,body,headings. I dont have a clue what to do …

Member Avatar for pythopian
0
129
Member Avatar for simpatar

I want make a program that calculates the cartesian products of two sets. e.g.: This is how i would like the result to look like: >>> Enter two sets to calculate the cartesian product: set([7,9]), set([1,5]) set([(7,1),(9,1),(7,5),(9,5)]) [CODE]def main(): userinput = input('Enter two sets to calculate the cartesian product: ') …

Member Avatar for pythopian
0
176
Member Avatar for lewashby

I recently posted a very small program the uses pygame and the livewires package but was unable to get the program to run. I think the Title for that posting was Graphics Window or something close to that anyway. Since I can't resolve that problem, does anyone have any suggestions …

Member Avatar for vegaseat
0
99
Member Avatar for lewashby

I have installed pygame and livewires but am getting the following error with the following short program that I got from my python book. [COLOR="Red"]AttributeError: 'module' object has no attribute 'init'[/COLOR] [CODE]# New Graphics Window # Demonstrates creating a graphics window from livewires import games games.init(screen_width = 640, screen_height = …

Member Avatar for vegaseat
0
236
Member Avatar for Ri0o

hi, i'm new in python programming i'm trying to write a simple program that processes a text file containing grades for a class, extracts the desired grades, count the number of grades in each grade segment and genrate a pie chart for grades,(A1) and here is the text file link …

Member Avatar for Ri0o
0
163
Member Avatar for Mathhax0r

My issue is essentially spelled out in the title. I want to be able to catch clicks (more specifically double clicks) on icons on the desktop or in folders or wherever, and tell where the click was on the icon (the coordinates of the click along with the whole size …

Member Avatar for Mathhax0r
0
104
Member Avatar for efecto
Member Avatar for efecto
0
243
Member Avatar for simpatar

This is my program: [CODE]def main(): print('This is a program to calculate the setprod') print() userinput = input('Enter two sets separated by a comma: ') value1, value2 = userinput.split(',') mylist1 = eval(value1.strip()) mylist2 = eval(value2.strip()) print(mylist1 + mylist2) main()[/CODE] If I enter following: [CODE]>>> This is a program to calculate …

Member Avatar for simpatar
0
103
Member Avatar for Mouche

So, I created this fun little Tic Tac Toe game all on my own. It was a tough project, and I know I used some inefficient strategies in the coding. Just like the other things I've posted, this could use a lot of suggestions in the areas of clean code …

Member Avatar for vegaseat
0
1K
Member Avatar for npn_

Sorry if this is a really easy question, but I've been going through control flows in the python documentation and something confuses me that it doesn't address. [CODE] a = ['Mary', 'had', 'a', 'little', 'lamb'] for i in range(len(a)): print i, a[i] [/CODE] When I type that in, it prints …

Member Avatar for npn_
0
87
Member Avatar for pdxwebdev

Ok, lets say I have a string [CODE] str = "main,sub,sub_sub" [/CODE] how could I use that to edit the value inside the dict [CODE] dicx = {'main':{'sub':{'sub_sub':'value to change'}}} [/CODE]

Member Avatar for masterofpuppets
0
113
Member Avatar for zyrus001

Having worked with txt files, I'm learning about binary now. My code below works for a while then bombs out, can you point me towards a method or module to read binary data line by line? The crypto module requires a buffer (don't know how to create one of those) …

Member Avatar for mn_kthompson
0
555
Member Avatar for sneekula

I am still rather new to the Linux OS and need some detailed advice on the installation of Python3.1 on my Ubuntu machine. Python3.1 is not in the Ubuntu package repository yet.

Member Avatar for pdxwebdev
0
1K
Member Avatar for pdxwebdev

[CODE] def doKey(e): print(e.widget.get("1.0","end")) root= Tk() root.title('yada') txta = Text(root, width=40, height=10) txta.bind("<Key>", doKey) txta.pack(side=LEFT) root.mainloop() [/CODE] Pressing a key in this text area will always output the string prior to your pressing the key. Am I missing something?

Member Avatar for pdxwebdev
0
142
Member Avatar for BattlingMaxo

I am a complete newbie to python but know some c++ Was wondering where i can get my hands on a 3D script for schooling(like fish) BattlingMaxo

Member Avatar for vegaseat
0
92
Member Avatar for masterofpuppets

hi all, I am designing a text editor program in Python using Tkinter and I was wondering if there's any way to get the current line number when the mouse is clicked somewhere on the text field, i.e the mouse position should determine the current line, like in the python …

Member Avatar for masterofpuppets
0
923
Member Avatar for kenmeck03

Write a function called NumDistinctDict that takes a single parameter alist that determines the number of distinct values in alist. For example, the list [1,2,4,2,7] contains 3 unique values (namely 1,2,4 and 7).

Member Avatar for vegaseat
0
112
Member Avatar for Zaffron

So I want to make a class based RPG, as a project to help me understand how classes work. Unfortunately, I didn't get far. The below code is intended to make an instance of a character and have info in it like name, health, gold, exp, and the like. I …

Member Avatar for vegaseat
0
74
Member Avatar for lewashby

How do you know when to use a function by wraping the content between parentheses "function(x) or through dot notation x.function() ? thanks.

Member Avatar for masterofpuppets
0
160
Member Avatar for henks83

I have no idea how to do this. Please help. This week's lab is to design a hangman game. Your program should be able to open a text file which contains a list of words (one word on each line of the text file) and read the words into a …

Member Avatar for masterofpuppets
0
954
Member Avatar for bunkus

Hi, I tried the following code to capture the contents of the foreground window to an avi-file. It works under Python 2.6 and OpenCV2.0 though it only takes about 210 shots and then crashes. I think it might be a memory problem. Any ideas? You need to resize the window …

Member Avatar for bunkus
0
811
Member Avatar for AutoPython

I can't find a compiler to compile version 3 Python scripts to .exe. All the compilers I see are all for Python 2.

Member Avatar for vegaseat
0
186
Member Avatar for tomtetlaw

I tried to make a leet speak converter, but it outputs characters that I don't even tell it to.. This is what I mean: (Test run) Enter something to convert to L337 5P34K: Hi, how are you? L337 5P34K equivilent: hi,@H0w 4R3 Y0u? I don't know why it's got the …

Member Avatar for willygstyle
0
530
Member Avatar for m.albert

Hi I have made a small program to record sound. I have a TK window with a record button. I would like to add a vumeter to this TK window. I use ubuntu and pulseaudio. If I type pavumeter in the terminal window I see a (pa) vumeter on my …

0
68
Member Avatar for thehivetyrant

Greetings Pythoneers. I've got this problem and the problem is thus: i have drawn a shape using [B]pygame.draw.circle[/B] i am finding it hard to make it move. i tried [icode]self.move_to(self.x-5,self.y)[/icode] and also [icode]self.forward(random.randint(0,10))[/icode] (Where forward is defined as a function as [icode]self.x,self.y + 10[/icode])<== I dont think i defined the …

Member Avatar for vegaseat
0
8K
Member Avatar for P3run

I just started to learn Python before a week or so and i found this example and rewrited it in Notepad++ (btw it was really painfull to figure out how to connect Notepad++ with python.exe but i like notepad++ more than Python GUI) and this program just wont work nor …

Member Avatar for snippsat
0
130
Member Avatar for python.noob

Hello geeks, First of all thanks to the members of this forum for their active participation, contribution and willingness to help. Now i'm in need of your valuable suggestions for my project in python. 1) I want to have GUI interface in my project and now i'm using python 3.1.1. …

Member Avatar for vegaseat
0
136
Member Avatar for nerdagent

Just like the title says. I need help on clicking on a box in a grid and filling it in with a color. Right now each block is 10x10 so I would have to use a 9x9 rectangle so it doesn't overlap. [CODE] #!/usr/bin/python import pygame,os,sys from pygame.locals import * …

Member Avatar for vegaseat
0
2K

The End.