15,190 Topics

Member Avatar for
Member Avatar for Frensi

I have a function and want to use time.sleep(2) everytime an attack happens, but what ends up happening is the time.sleep(2) will work for the first player and enemy attack, then the program will print the rest of the attacks instantly. Does anyone know what I'm doing wrong? def attack(player, …

Member Avatar for Ene Uran
0
7K
Member Avatar for sarelnet

Hi, I have a HTML page in one variable. I need build a mehod that will extract a tag content (dif extract_tag(self, tag_name)). For example, given webpage: <div id="mw-page-base" class="noprint"></div> <div id="mw-head-base" class="noprint"></div> <!-- content --> <div id="content" class="mw-body"> <a id="top"></a> <div id="mw-js-message" style="display:none;"></div> <!-- sitenotice --> <div id="siteNotice"><!-- centralNotice …

Member Avatar for ryantroop
0
252
Member Avatar for nchy13

i searched a llot but in vain. can anyone help me with how to include code written using GTK+ as module in a code that uses wxpython as toolkit. any help whatsoever is appreciated.

Member Avatar for Ene Uran
0
191
Member Avatar for python |

I am trying to pipe username and password (not to pass through command line for safety purposes) from one python script to another python script with some arguments. I was successful in perl implementing the above like this program - perl1: open(INPUT,"|perl my.pl $arg1 $arg2") or die "cant fork $!"; …

Member Avatar for Pervex
0
5K
Member Avatar for vegaseat

Just a simple text editor using the Tkinter expansion TIX. You are encouraged to improve this program with added functions. TIX is included with the latest Python distributions.

Member Avatar for Lardmeister
2
2K
Member Avatar for alakaboom1

Hi, I'm really new to both Pygame and Python. To get started, I just want to create a basic program of a sprite called "Player" in a background that responds to keyboard input. I pretty much just want to program it to move left and right in response to the …

Member Avatar for jmorris1324
0
415
Member Avatar for TrustyTony

Here are instructions for voting for winner of the code snippet competition! http://www.daniweb.com/community-center/threads/429756/code-snippet-contest-...-cast-your-vote

Member Avatar for TrustyTony
0
205
Member Avatar for Image1

Hi, I have some data like this, Actualy bigger than this more than this column and more than this rows. Run1 Run2 Run3 RUN4 Run5 1 23 123 1234 12.33 2 12 124 1225 13.123 3 15 125 1345 32.32 4 18 135 1456 12.23 5 19 137 1563 12.43 …

Member Avatar for vegaseat
0
167
Member Avatar for rev_ollie

Hi again I have another query I a struggling with that I would like to get some advice on. Basically put as part of a process we have a number of shortcuts created. These are Windows shortcuts based on an item id - so an example would be 1000.lnk Also …

Member Avatar for woooee
0
225
Member Avatar for Twist43

Hi I am trying to get a tkinter UI to allow me to do two things. * When I right click in a Treeview widget and my mouse pointer is over an item I would like the item to be selected as if the user clicked on it * When …

Member Avatar for Twist43
1
4K
Member Avatar for dwhite12

I have a code that takes a file and splits the file into two files. The problem I am having is when writing the lower half of the file I have two lines of whitespace I need removed. Here is what I have and am wonder how I could add …

Member Avatar for dwhite12
0
214
Member Avatar for alex.ashton.58

As a project after learning about classes, I'm trying to create a type of board game where the program tells you where all of it's pieces are, and then you tell it where you've moved your pieces, and then the AI moves its pieces accordingly. However I'm having a bit …

Member Avatar for alex.ashton.58
0
197
Member Avatar for ryantroop

So, in an exercise in futility, I decided to write a script that will take either a file or a string and find patterns in the words, and display the results for a nice friendly human use. Right now, it simply searches forwards and backwards(ish), but Im wondering if there …

Member Avatar for TrustyTony
0
153
Member Avatar for glenford11

while at work i had nothing to do so i wrote this simple python script that uses the dbm module to store user information its not perfect but im sure someone will find it helpful. import dbm,sys from time import ctime class Database(object): def __init__(self): self.userData = dbm.open("User Data", "c") …

Member Avatar for glenford11
0
295
Member Avatar for matt.w.deakos

What I want to do is use my variable in creating a lists name. I'm not sure if that's possible, but if it is my goal is to have it look something like this: i = 3 asdf = ['00','34','43','61','35','64','25'] asdf + i = [] # So in this case …

Member Avatar for TrustyTony
0
146
Member Avatar for rwe0

Using Python 3.2., wing ide: chr( i ) converts the integer i to a single character or string. How can I know which unicode encoding is being used ? When I execute the following code I get a single character symbol per character, including the protocol symbols such as ETX, …

Member Avatar for rwe0
0
230
Member Avatar for eternalcomplex

Hi, I'm trying to generate Docx files using python. I searched the web and found a module: https://github.com/mikemaccana/python-docx/blob/master/README.markdown It says to install using easy_install or pip, which I have no idea how to do. I also have a mac so I think that makes it a little more complicated. I'm …

Member Avatar for G_S
0
351
Member Avatar for rev_ollie

Hi, I have been looking at a few tasks I want to do using a MySQL DB and Python. Therefor I'm spending some time looking at the MySQLdb module for Python and how I can use it. I've worked out a few bits but I want to be able to …

Member Avatar for rev_ollie
0
8K
Member Avatar for Niner710

I have a large dictionary and want to filter the dictionary by values, which is in Hex. dataDict = { ('apple':0,'orange':0):0x8000, ('apple':0,'orange':1):0x0001,('apple':0,'orange':1):0x0010 } What I want to do is filter out the values of the dictionary according to a match. For example, one of the filters I would print out …

Member Avatar for TrustyTony
0
170
Member Avatar for kuchi

We are getting trouble when reading the data like ("â¦", "dóñez", etc) from a data file and storing into oracle DB, these are special characters and they must read and write into database as they are. These following areas where we are getting the problems: 1) when we use split() …

Member Avatar for kuchi
0
140
Member Avatar for debbie.chen.946

**I'm supposed to do a hangman project for my CSC class. I have the code here and it works when I type all the words into a word list, but I can't import the words from my file: words_dos.txt into a wordlist. Can someone please help me?** import random HANGMANPICS …

Member Avatar for woooee
0
235
Member Avatar for deepthought

Hi All, I have managed to get my program working now using UDP to send a message to a sensor and get a reply.The last major issue i am having is the data i recieve back. data, addr = sock.recvfrom(782) # buffer size is 782 bytes This is my line …

Member Avatar for TrustyTony
0
1K
Member Avatar for Twist43

Hi I am struggling with the Tkinter (ttk) Treeview. I want to allow the user to select multiple items in the Treeview using Shift and clicking. However I then want to be able to right click on the selection, or drag the selection using the normal left mouse button (B1). …

0
73
Member Avatar for Twist43

Hi I am busy building a small Python app in which I have two tkinter (ttk) Treeview widgets. I want to be able to drag an item (or multiple selected items) from the one treeview to the other, having the dragged items added to the treeview where they are dropped. …

0
143
Member Avatar for Frensi

I'm trying to make a battle function but am having some trouble. Is there a way to do this? At the moment I'm getting an error "AttributeError: 'function'object has no attribute 'att'. My guess is that this would be easier with classes, but I've not learned classes yet. So is …

Member Avatar for TrustyTony
0
171
Member Avatar for sandorlev

Hey guys! I'm having a hard time finding a way to set up pythonpath on a windows machine, by a script. I know how to do it manually, but I want to make a script that would add a certain directory to pythonpath and would save it. Thanks for reading, …

Member Avatar for Gribouillis
0
254
Member Avatar for Zeref

Hi guys, So I'm busy writing an application that needs to update a list from the web after a certain amount of time. main.py file class Gui: def ...... def ...... def ...... def on_update_click(): update() app=Gui() Gtk.main() So when the program loads up, user will click the update button …

Member Avatar for Zeref
0
315
Member Avatar for hughesadam_87

Hi, I'm curious about a few conventions. If you have a function that can return a or b based on some conditionals, which do you think is the best/accepted notation? def test(val): if val > 10: return a else: return b Or def test(val): if val>10: return a return b …

Member Avatar for sneekula
0
98
Member Avatar for fatalaccidents

Hey guys, My question is pretty simple but I haven't been able to run across it in any of the examples I've seen online. I want to basically have a GUI that asks some questions with comboboxs. I would like it to be where the one at top is the …

0
155
Member Avatar for deepthought

Hi All, I am trying to run a second script from my first script and this works ok i can send it a variable and recieve back my answer however I am using Tkinter for my forms but when i start the main my program both scripts run although i …

Member Avatar for deepthought
0
156

The End.