15,181 Topics

Member Avatar for
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
196
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
284
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
145
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
228
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
349
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
139
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
234
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
253
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
96
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
Member Avatar for hughesadam_87

Hi, I have several functions that I'd like to operate on both mutable and immutable containers (mostly tuples vs. objects) and I'm looking for the optimal way to test for mutability in these objects. I can think of many ways to do this. For example: try setattr: do mutable stuff …

Member Avatar for hughesadam_87
0
110
Member Avatar for thekilon

If you are a non coder that wants the easiest book to start with, something very simple, easy to read and short , that can take you step by step in learning the basics of python in a few hours then you may like the book I have created for …

Member Avatar for thekilon
2
396
Member Avatar for TrustyTony

There was discussion thread http://www.daniweb.com/software-development/python/threads/424953/polynomial-division for class based implementation for polynomials, and I developed a version utilizing the magic methods to enable operation with normal arithmetic operation. I only inherited sequence structure from list type. Interoperability with scalar types is not implemented to avoid too complicated type checks of the …

Member Avatar for TrustyTony
1
1K
Member Avatar for sokolov

I am new to python but have experience with Java. I am creating a bouncing ball program which throuhg a for loop creates a large sum of bouncing balls. I appreciate any help! Thank you import time from random import randint x0 = 10.0 y0 = 10.0 ball_diameter = 15 …

Member Avatar for TrustyTony
0
1K
Member Avatar for hughesadam_87

Hi, I have an object subclass that I am using with a cusom __repr__() method. class NewClass(object): def __repr__(self): return ', '.join('%s=%s'%(k, v) for (k,v) in self.__dict__.items()) This works fine (leaving out some more details about my program): test=NewClass(a=1,b=2) print test a=1, b=2 But what I really want for reasons …

Member Avatar for hughesadam_87
0
182
Member Avatar for Frensi

I'm learning about Classes and this thing is driving me crazy. Whenever I run this, it will use the __del__ object even though I never used del droid1, del droid2, or del droid3. Can someone please help? class Robots: '''Represents a robot, with a name.''' #A class variable, counting the …

Member Avatar for Gribouillis
0
299
Member Avatar for blackarchan

I have a problem i wrote a code and copyed some code but now my sprite dosent move anymore....and i dont know why # Import a library functions called 'pygame' import pygame from pygame.locals import * # Initialize the game engine pygame.init() # Define some colors black = (0, 0, …

0
146
Member Avatar for satnav_8

I'm trying to write a script that will search a page for mp3 files, and download the first one. All is fine, but when I'm finding the links the first two are not mp3 files. At the moment I'm doing: for link in page.findAll('a')[:3]: f.write(link.get('href')) This finds the first 3 …

Member Avatar for satnav_8
0
127
Member Avatar for Twist43

Hi I have always been a windows user but a few months ago switch to Ubuntu Linux. I have started learning Python and want to find out from experienced developers what the best way is to setup a development environment on a Ubuntu machine. I am running Ubuntu 12.04 which …

Member Avatar for Twist43
0
182

The End.