15,181 Topics

Member Avatar for
Member Avatar for ribot

Hello, I'm trying to deal a bit with IRC and Python 3. The decoding from bytes to Unicode create quite a dilemma. 1. Somehow it works to convert the å character from utf-8 to bytes, but the received bytes seem to often be encoded in latin-1, or at least they …

0
67
Member Avatar for hondros

Okay, so I have a tuple for a game, and this is it: [icode]['Hondros', {'Equiped': [['none', [], 0], ['Rags', [0, 1, 0, 0], 1, 1], ['Mocassins', [0, 0, 1, 0], 1, 1], ['Gauntlets', [0, 0, 0, 1], 6, 5]], 'Equipment': [0, 1, 1, 1], 'Stats': {'AC': 14, 'Strength': 15, 'Constitution': …

Member Avatar for hondros
0
168
Member Avatar for pyguy420

Im trying to write a code for a colour picker, so a user can pick 4 different colours and then it would return them so i can use them in a different par tof the program, but its not working properly and i can work out why. any ideas? [CODE]def …

Member Avatar for woooee
0
111
Member Avatar for lewashby

In the program below, I have two questions. First, the first object, card1 passes the strings A & c to it's master class. What I want to know is, what do these two strings have to do with the A & c in RANKS & SUITS? If the class had …

Member Avatar for woooee
0
96
Member Avatar for lrh9

I'm thinking about writing a small command line directory management program in Python. The most basic functionality I want is to be able to compare the the files in a directory and sub-directory, and if there are any duplicates then delete the lower most duplicate. I all ready have a …

Member Avatar for Gribouillis
0
92
Member Avatar for ffs82defxp

lets say i want to make a function that accepts a single argument that is supposed to be a number. lets say the function displays the range between 0 and the argument. Normally I'd do something like this: [CODE] def range_display(integer): set = [] for num in range(0, integer): range_list …

Member Avatar for snippsat
0
89
Member Avatar for stymiee

I use [url=http://www.en.wampserver.com/]WAMP[/url] to develop my PHP/MySQL applications locally before moving them to a production server. I want to start teaching myself Python and wish to add Python to my installation. I have downloaded and installed Python 2.5 and also installed mod_python. Unfortunately getting Apache to recognize that Python is …

Member Avatar for tweetychums
0
3K
Member Avatar for teenspirits

I made this code: [CODE]import random wish = "j" max_multiplications = 10 while wish == "j": multi = 0 right_answer = 0 while max_multiplications != multi: randomint1 = random.randint(1, 10) randomint2 = random.randint(1, 10) print randomint1, "*", randomint2, "=" ik = float(raw_input ("Insert your answer ")) multi += 1 answer …

Member Avatar for teenspirits
0
90
Member Avatar for cnuzzo

I have been teaching myself python for several months and have started working on an rpg project. Right now I am trying to code an armor class for a basic character. I am not sure if my approach is even a correct way to go about implementing this class. The …

Member Avatar for Mathhax0r
0
342
Member Avatar for fatalblade

hi , I have my python code but I couldn't solve it. here my sample loop: [CODE= python]import os import sys whileloop = True while(whileloop): initial_drive = "C:\\" inputline = input(initial_drive) <<< PROBLEM... if inputline == "exit": whileloop = False elif inputline == "about": print("no input") elif inputline == "": …

Member Avatar for fatalblade
0
166
Member Avatar for explorepython

Can you please tell me why i can't run this sample test program?? [CODE]from PyQt4 import QtGui class testui(QtGui.QTabWidget): def __init__(self,parent=None): QtGui.QTabWidget.__init__(self) def test(self): QtGui.QMessageBox.warning(self,"Hello","This is a test message") def frun(objec): time.sleep(8) print('hello') objec.test() app=QtGui.QApplication(sys.argv) obj=testui() obj.show() threading.Thread(target=frun,args=(obj,)).start() app.exec_()[/CODE] But in real i want to receive messages from the threads …

Member Avatar for explorepython
0
604
Member Avatar for bunkus

I have written code to use the automatic CD-Burn routine inside WinXP and above. But I cannot start the CD Writing Wizard by python code. Has anybody any idea how to do it? This is my code so far: [CODE]#!/usr/bin/env python # -*- coding: utf-8 -*- import os, sys import …

Member Avatar for bunkus
0
273
Member Avatar for hondros

Okay, I am in the middle of creating a rather large console RPG. It'll include ability to equip armor, weapons, interacting with NPC's, battles, saving/loading characters, etc. I don't want to save all of my classes and functions in the same file, for easier readability. I have a few questions: …

Member Avatar for vegaseat
0
86
Member Avatar for badboy00z

Hi everyone. I'm new to Python and programming in general. I'm currently reading [URL="http://www.dickbaldwin.com/tocpyth.htm"]this[/URL] tutorial. In the scripts section he mentions "setting the path" and that it needs to be done in order for scripts to work. How do I set the path in Windows XP? Thanks!

Member Avatar for vegaseat
0
113
Member Avatar for jcao219

This code is IronPython! Won't work with CPython. IronPython - Hello World [CODE] import clr clr.AddReference('System.Windows.Forms') from System.Windows.Forms import Application, Form, Label form = Form(Text="Hello World Form") label = Label(Text="Hello World!") form.Controls.Add(label) Application.Run(form) [/CODE] Editor's note: This post moved from Python GUI Programming sticky thread. Please follow the rules of …

Member Avatar for jcao219
0
117
Member Avatar for mdawaina

I need to know more about turbogears as one tools used to develop web by python (rapid development ). if any person know more information about this topic

Member Avatar for Stefano Mtangoo
0
48
Member Avatar for ShadyTyrant

Hi there daniweb, im looking for some help. I have two classes MainWindow(wx.Frame), and AddTask(wx.Dialog). MainWindow contains a listbox called task_list. When AddTask is created I want the user to fill out the required info and and then click a button activating an on_click event. In that event I want …

Member Avatar for ShadyTyrant
0
110
Member Avatar for vegaseat

Python uses the Mersenne Twister as the core random generator. The module random contains a fair number of methods (or functions) that help you to do random things. Here are some examples ...

Member Avatar for sainandan
1
218
Member Avatar for WOPR

>>> from os import * >>> a = [] >>> a = listdir('.') >>> f = open(a[0],'r') Traceback (most recent call last): File "<pyshell#4>", line 1, in <module> f = open(a[0],'r') TypeError: an integer is required doesn't work, please help me

Member Avatar for WOPR
0
87
Member Avatar for Destray

I'm working with Tkinter and I need to make 600 buttons in a grid of 6x100. Is there a way to produce generic variables by going through a for loop? Or do I have to type all 600?

Member Avatar for Destray
0
205
Member Avatar for Scuppery

If you are on school and you are taking algebra like me or just want to find the missing length of one side of the triangle than this program should help you out. Pythagorean Theorem Calculator is great and extremely essay to use thanks to this little program I pass …

Member Avatar for hondros
-2
2K
Member Avatar for monstercameron

need help correcting! first day,first 2 hours, first python program,(only had a little dark basic) [CODE]active="on" def ondamenu(): print "" print "enter integer 1 or 2" print "" print "opt.1 find the circumference" print "opt.2 find the radius" print "opt.3 quit calculator.py" print "" return input ("enter your choice: ") …

Member Avatar for woooee
0
151
Member Avatar for harpalss

hi there got a couple of probs, say in my text file i have: abase abased abasement abasements abases -------- This coding below is meant to find a word in a file and print all the lines to the end of the file. But it doesnt, it only prints out …

Member Avatar for d5e5
0
129
Member Avatar for Indran

Hi Gentlemen, I have an error, which was non existant when i used wxpython 2.8.7.1. When i upgraded to 2.8.10.1, basically the GUI got messed up.I am using Python 2.52 environment. The error seems to be from the fact that the parent, in this case MyFrame(wx.aui.AuiMDIParentFrame), is the default frame, …

Member Avatar for snippsat
0
318
Member Avatar for punter999

hello, i am new to python and i want to do development in python now. my problem is that: tell me what should be install in the system to start python development? tell me which is the best editor that can help to edit and run python code efficiently? tell …

Member Avatar for vegaseat
0
122
Member Avatar for JuvenileMango

How can I write a definition for a function that is passed a list of numbers and returns the sum of the numbers in that list using a while loop? I'm trying this, but it's not working def sumList(): num = [1,2,3] sum = 0 while num != str: for …

Member Avatar for JuvenileMango
0
88
Member Avatar for pith

Hello, I need help with editing this program: [code]#!/usr/bin/env python """ Monte Carlo simulation for the Monty Hall Problem: http://en.wikipedia.org/wiki/Monty_Hall_problem. """ import sys from random import randrange, shuffle, choice DOORS = ['car', 'goat', 'goat'] def pick_door(): """Return a number representing the player's first choice.""" return randrange(3) def reveal_door(pick): """Return the …

Member Avatar for pith
0
131
Member Avatar for thenewguy111

For my project I am coding battleship. I don't know how i should go about 1. mapping the board spots (dictionaries?) 2. randomizing ship placement any advice would be greatly appreciated PS. I am using pygame as well.

Member Avatar for Seten
0
123
Member Avatar for JuvenileMango

What is the difference between [CODE]file = open("name.txt")[/CODE] and [CODE]file = open("name.txt", 'r')[/CODE]? I can still use the methods: read(n), readline(n), and readlines(n) without adding the "r" in the open method.

Member Avatar for JuvenileMango
0
93
Member Avatar for letlet_pogs

Hello good day guys. I just want to ask for help in my java python. I am just new in this language. MY first java language is java. However, for me to make it easier to code in python, i need to code it in java first and then convert …

Member Avatar for vegaseat
-2
102

The End.