Posts
 
Reputation
Joined
Last Seen
Ranked #4K
Strength to Increase Rep
+0
Strength to Decrease Rep
-0
100% Quality Score
Upvotes Received
2
Posts with Upvotes
1
Upvoting Members
2
Downvotes Received
0
Posts with Downvotes
0
Downvoting Members
0
1 Commented Post
0 Endorsements
Ranked #2K
~20.5K People Reached
Favorite Forums

21 Posted Topics

Member Avatar for Shift_

Here is your problem: [CODE] choice = input("ENTER CHOICE: ") [/CODE] Changing 'input' to 'raw_input' will solve your problem. You must probably try this to know the difference: [CODE] >>> input( "Enter something: " ) 5 5 >>> input( "Enter something else: " ) britanicus Traceback (most recent call last): …

Member Avatar for TAJUL ISLAM_1
0
10K
Member Avatar for Ravi_exact

You could use `QDesktopWidget` to get the 20% of the width of the screen. Use `QDockWidget::resize` to set the initial size.

Member Avatar for britanicus
0
591
Member Avatar for mark.mcrae.92

You could try `from LookUpPath import LookUpPathPrefix` instead of `from LookUpPath import *` making your text function like this def test(): # Open the demo and training library from LookUpPath import LookUpPathPrefix fullfilename= LookUpPathPrefix('LIBRARIES') fullfilename = fullfilename+"_Libraries\"Here would be the aboslute path" if window('untitled'): select_menu('File>>Import Library...') if window('Select a Library …

Member Avatar for mark.mcrae.92
0
300
Member Avatar for britanicus

While I was trying to write a small program to preview DjVu files I encountered a peculiar problem. This is a small function that renders a page of a DjVu document into QImage class of PyQt4. import djvu.decode as DjVu from PyQt4.QtCore import QImage from PyQt4.QtGui import QPixmap, QApplication, QLabel …

Member Avatar for Ene Uran
0
482
Member Avatar for puddlejumper406

Both the above code cannot work properly. The reason is simple, the math is not done properly. Line 16:[ICODE]total_distance = miles + miles[/ICODE] and line 17: [ICODE]total_fuel = gallons + gallons[/ICODE] In both these cases you are just multiplying the no. of miles and no. of gallons the user has …

Member Avatar for woooee
0
312
Member Avatar for ozzyx123

Dear ozzyx123, I think you are on the right track. Just open your xls book before you start reading your email ( i.e before line 18. and add your headers ( line 119 to line 123 ). Initialize a counter before line 74 to 1 ( i.e. you have written …

Member Avatar for ozzyx123
0
1K
Member Avatar for ozzyx123

Please stop re-posting the same problem again and again!! Your older thread has an answer: http://www.daniweb.com/software-development/python/threads/416255

Member Avatar for britanicus
0
197
Member Avatar for chall77

Shouldn't you open the file, read the data and send the data as the input to secondDecode? say you save the module as nvr2b.py, then to decompress a file you should, [CODE] import nvr2b # Open the Compressed File cf = open( <compressedfilename>, 'rb' ) extractedData = nvr2b.secondDecode( cf.read() ) …

Member Avatar for britanicus
0
279
Member Avatar for linuxoidoz

Printing a table should not be any problem at all... Say, [ICODE]table[/ICODE] is the name of your QTableWidget, then to print, just iterate over the rows and columns, pick each QTableWidgetItem to get the text. [CODE] table = QTableWidget( NO_OF_ROWS, NO_OF_COLS ) # Add/Edit the data in the table # …

Member Avatar for britanicus
0
1K
Member Avatar for ben1996123

Your code does not work mainly for two reasons.. Firstly, line 21: [CODE] replpos == string1.find("a");[/CODE] You are not assigning any value for replpos, just comparing the values of replpos and string1.find("a"). "==" is for comparison and "=" is for assigning.. Secondly, the next line, line 22: [CODE] string1.replace(replpos+1, 1, …

Member Avatar for predator78
0
263
Member Avatar for Speleo

Are you sure you have run this program!! Just looking at the program I can point out at least 3 mistakes. Starting with line 12, entering 'encrypt' or 'decrypt' will raise NameError, unless im mistaken. Putting it in quotes will be of no avail, for that will end up raising …

Member Avatar for predator78
0
272
Member Avatar for katscandybar

You just have an indentation error!! Just increase the indentation level by 1 from line 91 to 99. Also i think there is an extra '_' in line 131 - you have typed 'legal__moves' instead of 'legal_moves'

Member Avatar for woooee
0
155
Member Avatar for kannibalkiwi

[CODE] while True : # Accept an input from the user reply = raw_input( "Enter an integer between 33 and 126: " ) # Check if it is indeed a number if not reply.isdigit() : continue # Convert it to number number = int( reply ) # Check if the …

Member Avatar for woooee
0
163
Member Avatar for NumeroUno123

use the inbuilt function [COLOR="Red"]bin[/COLOR] to convert decimal numbers to binary

Member Avatar for britanicus
0
165
Member Avatar for mscbme

Use PIL for reading bmp images: [CODE] import Image img = Image.open( "bmpfile.bmp" ) pixels = list() for row in img.size()[ 0 ] : for col in img.size()[ 1 ] : pixels.append( img.getpixel( row, col ) ) [/CODE] As for saving the file as dicom try the [URL="http://code.google.com/p/pydicom/"]pydicom[/URL] module

Member Avatar for britanicus
0
246
Member Avatar for pavanteja1987

threadedRotation.py [CODE] class threadedRotation : .... .... .... [/CODE] optimizer.py [CODE] from threadedRotation import threadedRotation class Optimizer : .... .... .... tr = threadedRotation( ... ) [/CODE]

Member Avatar for britanicus
0
196
Member Avatar for britanicus

This is a part the extension module im writing for python using c++. ( The complete source is available as an attachment ) [CODE] #include <python2.6/Python.h> #include <iostream> #include <fstream> #include "structmember.h" using namespace std; typedef struct { PyObject_HEAD fstream file; } CppFileObject; static int CppFile_init( CppFileObject *self, PyObject *args …

0
77
Member Avatar for nosehat

You cannot do that in python. But what you can do, is create a temporary file, read your original file, replace the bytes and write it into the temporary file, then copy it into the original location. This is more or less what you need. [CODE]from tempfile import mkstemp from …

Member Avatar for richieking
0
4K
Member Avatar for vlady

You could try this : [CODE] def histogram(string): hist = dict() for char in set(string) : hist[char] = string.count(char) return hist def print_hist(h): hist = histogram(h) for key in sorted(hist.keys()) : print '%s : %d' % (key, hist[key]) print histogram('this is a test string') print_hist('this is a test string') [/CODE]

Member Avatar for woooee
0
141
Member Avatar for alabandit

The syntax is str[from:to]. So typing string[10:] will return a string containing all characters beginning from the 10th character of your original string. To get the last 10 characters from a string you should type string[(len(string) - 10):]. A smarter way of doing it would be string[:-10]. The negative index …

Member Avatar for alabandit
0
259
Member Avatar for MJFiggs

You dont necessarily put your cTurtle.py into any of the folders. Make sure python searches the right locations for import : [CODE]import sys sys.path.append('/folder/in/which/cTurtle.py/resides') import cTurtle [/CODE]

Member Avatar for ultimatebuster
0
164

The End.