15,406 Topics

Member Avatar for
Member Avatar for lewashby

In the following program, what is the "values" function? [CODE]for tank in tanks.values(): if tank.alive: print tank.name, "is the winnter!" break[/CODE] I looked it up using Wing IDE and this is what I found. [CODE]def values(self, arg): """ D.values() -> list of D's values """ return [][/CODE] Thanks for any …

Member Avatar for sneekula
0
74
Member Avatar for Kruptein

I have a base template which is called every time a template is loaded with the [icode]{% extend 'base.html' %}[/icode] tag In that base file I have a navigation bar with a link to your inbox I want to show after the link a number with how many unread messages …

Member Avatar for Kruptein
0
91
Member Avatar for mbox_96

Hi, I'm trying to communicate to a GSM using AT commands and I found xebec module from 'http://sourceforge.net/projects/xebec/' use to communicate to cellphone and GSM, can anybody help me create simple script using this module , like sending "AT" and returns the "OK". Thanks, mbox_96

Member Avatar for Stefano Mtangoo
0
67
Member Avatar for pigmalion

Hi everyone, I'd like to create a child class to the date class in the datetime module and, apart from adding some new methods to it, I'd like my child class to be initializable through different argument arrangements. For example, beyond the (year, month, day) initialization arguments of the parent, …

Member Avatar for pigmalion
0
87
Member Avatar for SoulMazer

Hi, I'm trying to add an icon to my Tkinter GUI window and have had no luck. After some searching, I came up with the same piece of code which does not work. Here is a snippet of my code: [code=python]from Tkinter import * root = Tk() root.minsize(290, 700) root.title("My …

Member Avatar for SoulMazer
0
24K
Member Avatar for johnyboy82

Hi I am having problems using [B]subprocess.Popen.[/B] Here is a small script I have written [CODE]from subprocess import Popen import os global p def executeProcess(): cmd = "ls -l /home" global p p = Popen(cmd) #os.system (cmd)[/CODE] This works only once in a while. I keep getting the error [CODE]Traceback …

Member Avatar for woooee
0
132
Member Avatar for leegeorg07

Hi, I am trying to make a sublime text plugin that will compile some C code, but it uses python for these plugins. I already have a method of using g++ for single files, but I was wondering if anyone knows how to do it for a make file, here …

Member Avatar for leegeorg07
0
152
Member Avatar for leegeorg07

Hi, I'm trying to find an open source project to strect myself with, I have looked on bitbucket and couldnt find anything, any suggestions? Thanks in advance.

Member Avatar for leegeorg07
0
116
Member Avatar for mahela007

How can I make windows execute a python script when a flash drive is plugged into the computer? Is there a way to do this with python or do I have to use windows?

Member Avatar for mahela007
0
12K
Member Avatar for mordicaii

I can't load an image with Pygame, I've called pygame.image.get_extended and it returns false, is there any way I can fix this? What's even stranger, is that it was working earlier today. I don't remember doing anything to Python, Pygame, or OS X.

Member Avatar for vegaseat
0
175
Member Avatar for rehber344

hi everyone ı am a new begıner . why and when do we have to use "None" for example if x. is None: or at the definatıons def lookfor(a, b=None): return a, b why and where are we usıng None.whats the aım to use that and my other questıon ıs …

Member Avatar for hondros
0
127
Member Avatar for SoulMazer

I'm trying to bind a Tkinter widget to a method in another file. I'm not quite sure how to do this, but let me show you what I have so far. [code=python]#!/usr/bin/python # File1.py from Tkinter import * import File2 class MyFile: def __init__(self): master = Tk() obj = File2.DoStuff(master) …

0
71
Member Avatar for emir_gradacac

Hi, I would like to ask is it possible for pygame to respond on a key press immediately? I am trying to make a drumming simulation and the response comes after 1-2 seconds. The code is: [CODE]import pygame, sys from pygame import * pygame.mixer.init() pygame.init() #Loading sounds... snare = pygame.mixer.Sound('Snare.wav') …

Member Avatar for Lardmeister
0
426
Member Avatar for tigrum

Hello, I am currenty using MySQL 5.1 community server and trying to import the data of the comma delimited text file into the table using python 2.6 scripts. I have installed Mysqldb 1.2.2. follwoing is my script: [CODE] import MySQLdb, csv, sys conn = MySQLdb.connect (host = "localhost",user = "usr", …

Member Avatar for octav1
0
4K
Member Avatar for SoulMazer

Okay, well I have to say I am completely stumped where to go from here. I am writing a media player and I am currently working on song indexing. I have figured out how to extract the song name and its complete path using os.walk(); however, I have no idea …

Member Avatar for SoulMazer
0
112
Member Avatar for Ash_Pokemaster

Hello pals. We're having a project to make a Backup and Restore program in Python. As we think that making a GUI is of course very important, we started using Tkinter after initially trying wxPython which was kind of difficult given the time we had. Either way, we made a …

Member Avatar for Ash_Pokemaster
0
2K
Member Avatar for punter999

i want to create an editor GUI in wxpython with all the menu bar options and other things.kindly let me know if something similar has already been done or not if yes please let me know some of the dummy example so i can get an idea how to start …

Member Avatar for vegaseat
0
127
Member Avatar for deonis

Hello ! I'm trying to create the dictionary which would handle Latin characters like (Ã…), µ and so on. Apparently I'm require some sort of encoding to Unicode. Is there a way to handle this problem? see code bellow [CODE] wordDic = { '_chemical_formula_moiety': 'chemical formula ', '_chemical_formula_weight': 'Fw ', …

Member Avatar for deonis
0
209
Member Avatar for flatree

I am fairly new to Python and I am trying to understand how list comprehension works. I start with a list of nested lists (lis1), make a copy using list comprehension to give lis2 (in the function scan()). I use a for loop on lis2, to change the first item …

Member Avatar for snippsat
0
82
Member Avatar for sapi

Hey I'm trying to implement click-and-drag functionality on a frame (or, in this example, an image - but same difference). I need this because I want to run the app with wx.BORDER_NONE, which means no neat titlebar to drag. The code I'm using at the moment is this: (ignore the …

0
64
Member Avatar for fferrandini

Hi great ones, i have a form that i save employees photos to server and URIs to DB. Doing some tests yet. I can save in the server without no problem. the javascript callback function aint being fired .. dont know why; below is the code.. i appreciate any help …

Member Avatar for fferrandini
0
121
Member Avatar for mehdi0016

hi i want to create menu with icon beside it, but i don't know how and with which gui lib is it possible? please help me.

Member Avatar for mehdi0016
0
105
Member Avatar for fferrandini

Hi folks, I dont need any code snippet, but at least i need somebody to lead me to a solution. I got an app form that will have personal info from employees, and i need to let them pick a photo from filesystem to attach to this form. what i …

Member Avatar for vegaseat
0
167
Member Avatar for vlady

Hi everybody, Pls give me sb. a hint. I do this following exercise but I struggle with reading another lines of txt. Here is the text: Exercise 9.1 Write a program that reads words.txt and prints only the words with more than 20 characters (not counting whitespace). here is my …

Member Avatar for vlady
0
4K
Member Avatar for eva yang
Member Avatar for eva yang
0
98
Member Avatar for GihanFernando

Hello all, I would really appreciate help with this seemingly basic problem. Here is my code; [code]import wx import FloatSpin as FS class DesignConditions(wx.Frame): def __init__(self,parent,id): wx.Frame.__init__(self,parent,id,'Design Conditions',size=(1000,700)) panel = wx.Panel(self) wx.StaticText(panel,-1,'Atmospheric Temperature (K): ', (25,150)) wx.StaticText(panel,-1,'Atmospheric Pressure (kPa): ', (25,200)) wx.StaticText(panel,-1,'Mach Number: ', (25,250)) wx.StaticText(panel,-1,'Ratio of Specific Heat Capacities …

Member Avatar for vegaseat
0
107
Member Avatar for mahela007

I was using the datetime module for the first time today. When I typed [CODE]now = datetime.date.today() now [/CODE] I got the output [CODE] datetime.date(2009, 12, 27) [/CODE] Now, I found out that [CODE]datetime.date[/CODE] is a class and that[CODE] datetime.date.today[/CODE] is a method. But I can't figure out what the …

Member Avatar for snippsat
0
1K
Member Avatar for xvalentinex

Okay python gurus, this one has me stumped. Is it possible to introspect and obtain the instance of a class that assigned a class? I have a simple sample that demonstrates what I'm looking for, but doesn't make any sense why you would do it. [code=python] class One(object): def print_parent_hw(self): …

Member Avatar for xvalentinex
0
89
Member Avatar for Stefano Mtangoo

Hi, Iam now using Mandriva from external HDD and want to install my development tools. I need to install wxPython, Matplotlib, and some other packages. How to do that in Mandriva?

Member Avatar for Stefano Mtangoo
0
149
Member Avatar for vegaseat

This is an update of an earlier version. In this version the string containing the approximated pi value is created directly from the iteration of the generator. This way the program is simplified and can be used with Python2 and Python3 ...

1
595
Member Avatar for deonis

I am trying to develop a function for my application which would use already opened file (fin) and read certain line from it. Each line in the text starting from given keywords (pos1). Finally this function should return a print of all line containing the keywords pos1. But apparently "linecache" …

Member Avatar for deonis
0
272
Member Avatar for hdk

Hi All, I am very new to python Gui programming and am trying to create a simple Gui which will get a set of results from an sql query which goes into Oracle and display these results in the text box below. If u can also help me get the …

Member Avatar for Stefano Mtangoo
0
351
Member Avatar for lewashby

In the following program, why do I need to use the name "player" rather than a regular counter like "i"? I ran the program this way and it prints out the last element in players for how ever many player elements are in players. I want to know what's going …

Member Avatar for jcao219
0
113
Member Avatar for Kruptein

the code on my localhost and on the server are completely the same (django), but it is not shown correctly; I include two screenshots What could be the cause of the difference? (the left one is the online server; the right one is the localhost)

Member Avatar for hondros
0
325
Member Avatar for rmsagar
Member Avatar for vegaseat
0
201
Member Avatar for eva yang
Member Avatar for vegaseat
0
132
Member Avatar for punter999

hello Seniors, i am new to python development.i have started my internship in that language. can any one provide me the code that show me how to add subtract and multiply matrices in python.??? what will be the code if i want to take input from the user to enter …

Member Avatar for vegaseat
0
150
Member Avatar for kbalamuk

I want to replace 'nf' with 1.0, so that the resulting string should be: '(1.0+nfpermult+1.0)' I tried various approaches using find(), re.sub but I am not able to make it work. eg. re.sub('nf', '1.0', str) replaces all occurrences of nf. also re.sub('\bnf\b', '1.0', str) does not work either as 'nf' …

Member Avatar for vegaseat
-1
6K
Member Avatar for badboy00z

[QUOTE=vegaseat;250820]This little code shows 6 random integer numbers from 1 to 50 ... [code]import random print "show 6 random integers from 1 to 50:" for k in range(6): r = random.randint(1, 50) print r, print [/code] Rewrite the code to make sure there are no duplicate numbers amongst the six …

Member Avatar for badboy00z
0
860
Member Avatar for hondros

Okay, I'm creating a Battleship game. It's going to be using the console for now, still don't know GUI. Anyways, this is my issue. I have created two boards as lists, the first for the user, the second for the computer. I have the computer generate random numbers and a …

Member Avatar for hondros
0
103
Member Avatar for rehber344

hi everyone ı have a very big text file which is 35mb and that includes 85000 lines. those lines are the rules of ıptales and from the command shell ı do paste and copy and as you can see it that ıs very diffucult to paste every lıne ı trıed …

Member Avatar for woooee
0
188
Member Avatar for BlackPhoenix

Hi everyone, having trouble coming up with the right code for 8 directional movement [ up, upright, right, downright, down, downleft, left, upleft] My keypress handling is: [CODE] if event.type == KEYDOWN: if event.key == K_LEFT: player.moveLeft = True player.moveRight = False if event.key == K_RIGHT: player.moveRight = True player.moveLeft …

Member Avatar for JugglerDrummer
0
308
Member Avatar for masterinex

Hi, I want write a program which extract 'Rated PG for some scary moments and mild language' from the following html file and return it as a list . html file: <div class="info"> <h5><a href="/mpaa">MPAA</a>:</h5> <div class="info-content"> Rated PG for some scary moments and mild language. (also 2009 extended version) …

Member Avatar for vegaseat
0
236
Member Avatar for Democles

I'm not sure this is the correct forum for this, but it's at least relative. I was wondering if anyone knew of some decent references and ebooks for a beginning Django user.Yes, I know djangoproject has tutorials, but there decently hard to understand. If someone could either help or steer …

Member Avatar for Stefano Mtangoo
0
80
Member Avatar for curiouskitten

I need to convert a number (in decimal form) that is between 1 to 4999 to Roman Numeral Form. However, though the code I have is kinda working, its only outputting the thousand digit, not anything less or any part thats less. [code] def int2roman(number): numerals={1:"I", 4:"IV", 5:"V", 9: "IX", …

Member Avatar for vernondcole
0
4K
Member Avatar for vsagarmb

Hi, I am trying to pack a unicode string of 40 bytes using the pack method. [code=python] data = pack('<8sB40s', asc_time, language_id, message) [/code] it throws the following error: struct.error: argument for 's' must be a string What is the argument for a unicode string? Thanks in advance.

Member Avatar for d5e5
0
176
Member Avatar for mehdi0016

hi currently on my ubuntu i have both wx-2.6-gtk2-unicode & wx-2.8-gtk2-unicode installed, but when i use this code in python 2.6 : [CODE]import wx[/CODE] always wxwidget 2.6 was imported. is there any solution to have both or it's better to uninstall version 2.6 ? thanks

Member Avatar for vegaseat
0
94
Member Avatar for El Duke

Hi all, I have this dilemma, if I receive strings on the form of: <Ranking: AA (John)> <Ranking: CA (Peter)> <Ranking: TA-A (Samantha)> And I want to take the ranking only from the strings (i.e. AA, CA, TA-A) How can I do it using string methods like split or strip …

Member Avatar for vegaseat
0
139
Member Avatar for punter999

hello, i want to utilize the demo code given in the wxpython 2.8 documentation & demos. can any one guide me how can i do that??? when i try to copy that code to editor to change it according to my requirements ..it gives me an error message and close …

Member Avatar for vegaseat
0
99
Member Avatar for fferrandini

Hi, I wonder how to use wx.FileDialog with turbogears . I have this turbogears project, and i have a form which add new employees, and for each employee i need to let the person who is adding them to pick a photo from his filesystem. And all wxPython guides already …

Member Avatar for Stefano Mtangoo
0
96

The End.