15,190 Topics

Member Avatar for
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
81
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
61
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
118
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
101
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
165
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
95
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
106
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
87
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
146
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
578
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
271
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
350
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
109
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
316
Member Avatar for rmsagar
Member Avatar for vegaseat
0
198
Member Avatar for eva yang
Member Avatar for vegaseat
0
128
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
142
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
850
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
101
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
184
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
301
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
235
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
79
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
166
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
93
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
136

The End.