-
Began Watching cmplex python problem
Write a program that reads n digit number. after reading the number, compute and display the sum of odd positioned digits,multiply all even positioned digits and add the two numbers. … -
Replied To a Post in cmplex python problem
If you print "digit" you will see that it goes from right to left so for input that is an even number in length, the code is bass ackwards. Also … -
Began Watching Programming Sucks
This is just too good not to share with everyone. >The only reason coders' computers work better than non-coders' computers is coders know computers are schizophrenic little children with auto-immune … -
Replied To a Post in Programming Sucks
Unlike people, you can turn the computer off. -
Began Watching Random Facts
I'm hoping that people will post unusual or little known facts here. It would be proper to include a link to a source for confirmation. Here's a start. Speedy Gonzales … -
Replied To a Post in Random Facts
The Xerox Palo Alto Research Center, known as Xerox PARC, developed the graphical user interface (GUI), laser printing, WYSIWYG text editors, and Ethernet. And perhaps more importantly developed object oriented … -
Replied To a Post in Help with Classes
This certainly sounds like homework, i.e. lists must be used. Another way is to sort the list first and then count. original_list = ["hello", "hi", "hi", "bye", "hi", "bye"] original_list.sort() … -
Began Watching How to check signal emit finished in python
Hi, I have created one signal in python using pyside. I'm connecting with that signal 3 times with 3 different methods. when i emit this signal, it has to execute … -
Replied To a Post in How to check signal emit finished in python
Cross posted so may have already been answered. Check first so you don't waste your time. http://qt-project.org/forums/viewthread/46750 http://bytes.com/topic/python/answers/958375-how-check-signal-emit-finished-python -
Began Watching Break up a sequence into groups of 3 elements
I would like to break up a list into sublists of 3 elements each. I have this code, but it will give an index error when the length of the … -
Replied To a Post in Break up a sequence into groups of 3 elements
There are several ways to do this. I prefer a while loop ## Not divisible by 3 mylist = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] … -
Began Watching Help with Classes
I have a class containing: class CounterList: __n_comparisons__ = 0 def __init__(self, data=None): if data is None: self.data = [] else: self.data = data self.__n_accesses__ = 0 def __getitem__(self, i): … -
Replied To a Post in Help with Classes
> using a list, return a 'counterlist' containing all the strings in the original list plus the number of times the string appears in the list You want a list … -
Replied To a Post in how to read dictionary names from a text file and display in a text widget
You can also use a function to create the widgets and simplify the code. Note that each entry box is appended to the list so clearing them is just partsing … -
Began Watching how to read dictionary names from a text file and display in a text widget
#i use python 3xx from tkinter import * from tkinter import ttk # i couldnt install PIL on my computer so I used Pillow. Hope you dont run into any … -
Replied To a Post in how to read dictionary names from a text file and display in a text widget
> this is where my problem is,,,i cant use this fuction to read from the text file and display the corresponding results in the text widget I don't understand what … -
Began Watching Image manipulation/steganography Tkinter... can't get image objec in canvas
def askopenfilename(self): filename= tkFileDialog.askopenfilename(initialdir='C:/..',title='Select File' , filetypes=[('Bitmap Images', '*.bmp'),('Png Images', '*.png'),('Gif Images', '*.gif'),("Jpeg","*.jpg"),("All files", "*")]) self.entryVariable.set(filename) if filename == None: return open(filename,'rb') self.entry.update(filename) self.image = Image.open(filename) self.img = ImageTk.PhotoImage(self.image) self.canvas.config(width=400, … -
Replied To a Post in Image manipulation/steganography Tkinter... can't get image objec in canvas
What does it do differently than what you expect? A simple example with an explanation of what you want will get faster and better results Note that encode_files is declared … -
Began Watching Takes 3 Arguments But 1 is Given.
def askopenfilename(self): filename= tkFileDialog.askopenfilename(initialdir='C:/..',title='Select File' , filetypes=[('Bitmap Images', '*.bmp'),('Png Images', '*.png'),('Gif Images', '*.gif'),("Jpeg","*.jpg"),("All files", "*")]) self.image = Image.open(filename) self.photo = ImageTk.PhotoImage(self.image) self.label = Label(self.photo) def encode_files(self,image,data): #get the image file … -
Replied To a Post in Takes 3 Arguments But 1 is Given.
Please post the entire error message as we have no idea where it may be coming from. The call to encode_files, may be the problem but that code is not … -
Began Watching python mortgage amort calculator
Hi all, i am trying to write a mortgage amortization schedule calculator and am stuck. please see the code below. It appears that the principal is being counted twice before … -
Replied To a Post in python mortgage amort calculator
I would suggest that you first write it out on paper with 2 or 3 actual examples of what you want and then see how the program differs from the … -
Began Watching lamda expression to match beginning of line with any digit
I'm trying to design a lambda function that returns any line in a file that begins with any digit [0-9]. The point would be to return the whole line if … -
Replied To a Post in lamda expression to match beginning of line with any digit
It is a good idea to strip() a record first, unless you are really really sure of the format. Lambda is a bad habit IMHO. Guido wanted to omit lambda … -
Began Watching tkinter - binding key commands to the numpad in windows
So, I'm writing a smallish adventure game in Python, which operates by means of commands being typed into a tkinter textbox, hitting enter or pressing a button to submit said … -
Replied To a Post in tkinter - binding key commands to the numpad in windows
This code from Vegaseat tells you which key is pressed. You can use a similar function that tests for cetain keys and responds accordingly. I think the general binding is … -
Began Watching A bit help
**Hi I am new here, I am learning Python, but I am mess up on this script and it keep asking the same input question... please help thanks.. ps how … -
Replied To a Post in A bit help
while not (done): will loop until done==True To get done==True in the code you posted, you have have to enter "s" on your only input line, i.e. choose=input("\nChoose a class … -
Began Watching Decimal formatting
In my python class, we are using python 3.4.1 And we are typing in the programs from the book. Well, I've typed it in correctly and the output still doesn't … -
Replied To a Post in Decimal formatting
"Aligning" depends also on the font used. If you are displaying the result in the console, then the console must use a fixed witdth font. If you want to experiment, … -
Began Watching Plotting 3 columns or more data on the Graph (python)
Hi, this program of mine can plot timestamp & irradiance but how can i plot another line of data for temperature? This is my txt data: TimeStamp,Irradiance,Temperature 21/7/2014 0:00,0.66,26.2 21/7/2014 … -
Replied To a Post in Plotting 3 columns or more data on the Graph (python)
[This example](http://matplotlib.org/examples/api/fahrenheit_celsius_scales.html) from the pyplot examples page, plots two scales, and there are probably more. -
Replied To a Post in IndexError: list index out of range
That tells you nothing. You have to print it on the line before the error message on every pass through the for loop so you know where and what the … -
Replied To a Post in IndexError: list index out of range
If channelList has less than seven entries then you will get an error on channelList[index]. You will have to print channelList and/or len(channelList) to see where the error is. -
Began Watching Get the mouse position on the screen on Linux.
This snippet defines a function [icode]mousepos()[/icode] which gets the mouse position on the screen. The package python-xlib is required. -
Replied To a Post in Get the mouse position on the screen on Linux.
Sweet. Much nicer than termios solutions. -
Began Watching IndexError: list index out of range
Hi all I need your help, I'm working on my python script to fetch the list of channels from the sqlite3 database. I'm fetching 7 channels to set each channel … -
Replied To a Post in IndexError: list index out of range
We don't know which one of at least 3 or 4 possible statements is causing the error because you did not include the error message. As a shot in the … -
Began Watching Save text area to selected file
Hi, I am trying to make my "Save All" button to save whatever is selected from the option menu or dropdown to that particular file. So if I have "animation" … -
Replied To a Post in Save text area to selected file
You have to use the get() method of the StringVar. See the second, or get() example at [Click Here](http://effbot.org/tkinterbook/optionmenu.htm) i.e convert from a Tkinter variable to a Python variable -
Began Watching builtins.UnicodeDecodeError:
builtins.UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd2 in position 14: invalid continuation byte I'm getting the following error that pops up not in my script but in the codecs.py file. … -
Replied To a Post in builtins.UnicodeDecodeError:
builtins.UnicodeDecodeError: 'utf-8' Don't know much about unicode but it may be that the OS is not set up for utf8, so include this at the top of the file to … -
Replied To a Post in Things I hate about TV shows
> as well as the annoying ads that are continuously popping up from the bottom of the screen. Recently I was flipping through the channels. One show had a popup … -
Began Watching Problem solving skills
Everyone says the same thing: "a real programmer knows how to handle real problems." But they forget how they learned this ability or where: it's not taught in schools. 1. … -
Replied To a Post in Problem solving skills
And problem solving skills only work when the problem is defined. A well defined problem is 50% solved or more IMHO. -
Began Watching need help passing an argument through signal emitted from a function
Hi need help passing an argument through signal emitted from a function at module level, when the function is executed I want to emit a signal with an argument whose … -
Replied To a Post in need help passing an argument through signal emitted from a function
You would use partial. I don't have Qt installed so can't test, but this should work. Note that if it is self.thrown error, you don't have to pass it to … -
Began Watching Downloading the file and cancel it
Hi all, I need some help regarding how to cancel the connection from my server using the urllib2 library. I want the database to stop writing the data away as … -
Replied To a Post in Downloading the file and cancel it
I only know multiprocessing. The example below starts an infinite loop in a process and uses the terminate method to end the thread, which could also be tied to the … -
Began Watching How to set the value in setLabel function more than once?
Hi all, I'm running on python version 2.6 for xbmc media application, but I'm having trouble with setLabel function. When I run the code, it will update the value in …
The End.