57 Solved Topics

Remove Filter
Member Avatar for sneekula

In the last couple of threads people have used the Python class, but really don't seem to know how to use them properly, or why to use them. Hence my question: "Why would you use a class in Python?" I though only Java forces you to use OOP.

Member Avatar for Vineetha_1
0
4K
Member Avatar for sneekula

On Windows7 I am trying to read file C:\programdata\microsoft\application virtualization client\SoftGrid Client\sftfs.fsd using a Python program, but I get a PermissionError. How do I get permission? Why does folder programdata not show in the Microsoft file manager/explorer?

Member Avatar for RobertHDD
0
256
Member Avatar for sneekula

On my Raspberry Pi computer I did a search for PIL and matplotlib with apt-cache search python but could not find anything close in the list. Is PIL/Pillow and matplotlib available for Linux and what is it called? The Raspberry Pi has Python27 and Python32 installed.

Member Avatar for vegaseat
0
394
Member Avatar for sneekula

I have a tkinter program like the one below (for example) and want to create an executable file using module cx_freeze. I am using Python33 and Windows7. # Tk_circle2.py # draw a circle with given center (x,y) and radius # tkinter normally needs a specified square try: # Python2 import …

Member Avatar for vegaseat
0
2K
Member Avatar for sneekula

There used to be a Python module called pyglet that allowed graphics and sound. I can't find it anywhere.

Member Avatar for sneekula
0
256
Member Avatar for sneekula

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 list is not divisible by 3. mylist = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] …

Member Avatar for sneekula
0
260
Member Avatar for sneekula

I asked that in another thread, but it got lost: [QUOTE]When do you use root.quit() and when do you use root.destroy() to exit a Tkinter program?[/QUOTE] Also, can you intercept an exit when you use the little x in the title bar, just to affirm that you really want to …

Member Avatar for entropicII
0
45K
Member Avatar for sneekula

Just wondered which computer language is best suited for preteen students. Any ideas or experiences?

Member Avatar for Sanchixx
0
482
Member Avatar for sneekula

I need a function that returns True or False if an integer n is a prime. Any 'high speed' thoughts?

Member Avatar for wallars
0
1K
Member Avatar for sneekula
Member Avatar for sneekula

I need to read in a text file, replace selected words and write the changed text back out to a file. Is there an easy way with Python?

Member Avatar for halamas
0
20K
Member Avatar for sneekula
Member Avatar for TrustyTony
0
6K
Member Avatar for sneekula

I have a text I want to search for all it's upper case letters, then present these letters unique and sorted. I welcome any suggestions.

Member Avatar for twekberg
0
325
Member Avatar for sneekula

How would you make a simple bar graph from a list of data? [code]data = [20, 15, 10, 7, 5, 4, 3, 2, 1, 1, 0] [/code]

Member Avatar for Stefano Mtangoo
0
562
Member Avatar for sneekula

I was trying to create a 3x3 list of lists, and came up with this surprising behaviour: [code]# creating a 2D list with an overloaded * operator mlist3 = [[0]*3]*3 print mlist3 # [[0, 0, 0], [0, 0, 0], [0, 0, 0]] mlist3[0][0] = 1 print mlist3 # [[1, 0, …

Member Avatar for Mathhax0r
0
1K
Member Avatar for sneekula

I just bought an inexpensive used Dell notebook that has Ubuntu/Linux as an operating system. Compared to Vista this is sweet. It came with Python25 installed, but it was easy to use the Add/Remove application feature to get open source software from the Ubuntu site. I downloaded/installed Stani's Python Editor …

Member Avatar for MaxVK
0
332
Member Avatar for sneekula

Every now and then Vista comes up with a "Program Compatability Assistant" popup window (see image) when you want to run a .exe file. If you make the mistake, like I did, and agree with the Administrator option, then from hence foreward everytime you want to run this particular executable …

Member Avatar for sneekula
0
151
Member Avatar for sneekula

I have a dictionary of chemical symbols and names, to look up the symbol and get the name is easy, but to find the symbol of a given chemical name seems to be more akward. Am I missing something here? [code=python]# small dictionary of chemical symbols symbol_dic = { 'C': …

Member Avatar for jrcagle
1
245
Member Avatar for sneekula

I want to make a small Molecular Weight calculator. If the user for instance enters the molecular formula for dichloro-benzoic acid as "C6H3Cl2COOH", I would like to split it into a list like ['C6', 'H3', 'Cl2', 'C', 'O', 'O', 'H'] so I can then combine all the carbons, chlorines, oxygens …

Member Avatar for sneekula
0
118
Member Avatar for sneekula
Member Avatar for sharma_vivek82
0
196
Member Avatar for sneekula

The last time I posted a question here, I got a rather nasty response, so please just constructive stuff! I want to make a scrollable entrybox for Tkinter GUI, the scrollbar shows up and works, but text does not move. Am I missing something? [code=python] import Tkinter as tk root …

Member Avatar for sneekula
0
758
Member Avatar for sneekula
Member Avatar for aot
0
3K
Member Avatar for sneekula
Member Avatar for vegaseat
0
118
Member Avatar for sneekula

I know that you can do integer calculation in Python with astronomically large numbers. What is the precision limit when using floats?

Member Avatar for vegaseat
0
165
Member Avatar for sneekula

I know you can get the present time this way: [code]import time now = time.asctime(time.localtime()) print now # Mon Feb 19 10:41:32 2007 [/code]How can I make sure that 'now' does not fall on our lunchtime break, let's say 11:30AM to 12:45PM?

Member Avatar for sneekula
0
161
Member Avatar for sneekula

Is there a way to preselect/highlight a listbox item with the Tkinter GUI toolkit at the startup of the program without clicking the mouse on it?

Member Avatar for sneekula
0
1K
Member Avatar for sneekula

I keep reading threads here, some use the Tkinter GUI toolkit and others use the wxPython GUI toolkit. Why would one use one or the other?

Member Avatar for sneekula
0
1K
Member Avatar for sneekula

The department's computer has Python 2.4 and on my home computer (really my dad's computer) I installed Python 2.5. Is it possible to have Python 2.4 and Python 2.5 on the same computer?

Member Avatar for vegaseat
0
114
Member Avatar for sneekula

Since there is so much discussion on one of the threads on zipping/unzipping files and all the associated incompatibilities, is there a way to do this with Python and cut out the middleman?

Member Avatar for vegaseat
0
136
Member Avatar for sneekula

I know that one has to be careful with mutable arguments like lists applied to function calls, so that things like this won't accidentally happen: [php]def add_item(list2): list2.append(99) return list2 list1 = [1, 2, 3] list3 = add_item(list1) print list1 # [1, 2, 3, 99] oops! print list3 # [1, …

Member Avatar for jrcagle
0
230
Member Avatar for sneekula

I took a mixed type list and set out to find the min and max values. The results are very surprising to me: [php]mixed_list = [11, 'Dick', 12, 'Mary', 7, 'Zoe', 9, 700, 777, 'Paul', 13456789] mn = min(mixed_list) mx = max(mixed_list) print mn, type(mn) # 7 <type 'int'> print …

Member Avatar for vegaseat
0
3K
Member Avatar for sneekula

I was experimenting with the nested list example in thread: [URL]http://www.daniweb.com/techtalkforums/post246791-72.html[/URL] and was trying to search a nested list like that: [code]nested_list = [1 ,'Dick', 2, ['Mary', 7, 9, [700, 777, 'Paul']], 13] if 'Paul' in nested_list: print 'found Paul' else: print 'Paul not found' [/code]It always tells me that …

Member Avatar for vegaseat
0
106
Member Avatar for sneekula

I want to make a Tkinter button respond to a left and right mouse click differently. How can I do this?

Member Avatar for vegaseat
0
8K
Member Avatar for sneekula
Member Avatar for sneekula
0
12K
Member Avatar for sneekula
Member Avatar for Ene Uran
0
13K
Member Avatar for sneekula

I like to create a database of common chemicals with Python. How would I go about that? Any help welcome!

Member Avatar for Ene Uran
0
119
Member Avatar for sneekula

This came up on Chris99's bus ticket program thread. Would like to see any simple examples on how to pass variables between classes without using global variables.

Member Avatar for vegaseat
0
19K
Member Avatar for sneekula

As you can see, I am playing around with the Tkinter GUI toolkit. How can I keep a number of widgets fixed in a location even when the user expands the window?

Member Avatar for sneekula
0
195
Member Avatar for sneekula

I am writing a small Python program for the use in our departments stockroom. This is what I have come up with (just starting): [php]# table of chemicals in stockroom # order --> stock number, chemical name, quantity (grams) # short version of the table table = [ ['ud-99137', 'm-chlorobenzoic …

Member Avatar for sneekula
0
155
Member Avatar for sneekula

Is there a way to make a Tkinter GUI window that the user can not change the size of?

Member Avatar for sneekula
0
162
Member Avatar for sneekula

I have a directory with many subdirectories. Each subdirectory contains a small number of image files (.jpg). I would like to accumulate all these image files in a Tkinter listbox, sort them and be able to select blocks of files and send them to another listbox. Ultimately I would like …

Member Avatar for Ene Uran
0
3K
Member Avatar for sneekula

I have a data file with chemical names (one name per line) and want to load that into a Tkinter GUI listbox and then be able to select it by clicking on the line. Need some help.

Member Avatar for vegaseat
0
2K
Member Avatar for sneekula

I am experimenting (playing around) with the Python Tkinter Gui, and wondered if there is a way to play a sound like from a .wav or .au file?

Member Avatar for sneekula
0
5K
Member Avatar for sneekula

I know that Pyhon compiles source code to a Byte Code before the interpreter works on it. What does this Byte Code look/behave like?

Member Avatar for vegaseat
0
148
Member Avatar for sneekula

I keep reading about endless loops, is that something you want or do you always have to control an endless loop situation?

Member Avatar for bumsfeld
0
131
Member Avatar for sneekula

Which Graphics User Interface (GUI) would you recommend for a beginner? I have seen some examples of Tkinter, wxPython and GTK.

Member Avatar for vegaseat
0
435
Member Avatar for sneekula

I have a color data file that gives the color name and its RGB values, for instance like this: [CODE] red RGB(255,0,0) green RGB(0,128,0) blue RGB(0,0,255) brown RGB(165,42,42) gold RGB(255,215,0) maroon RGB(128,0,0) [/CODE]I like to create a color dictionary from this file that looks like this: [CODE] {'red': (255,0,0), 'green': …

Member Avatar for sneekula
0
194
Member Avatar for sneekula

When do you use a for loop and when to use a while loop. Are there other loop types in Python? Some of the slicing examples almost look like loops.

Member Avatar for fireworks-style
0
189
Member Avatar for sneekula

I have a file of sentences similar to this: [CODE] Tom ate his Apple. Frank shoveled Snow. Henry drove a Truck. [/CODE]I would like to prosess each sentence so it only retains the capital letter in the first word, every other word in the senetnce should be lower case. The …

Member Avatar for Mouche
0
122
Member Avatar for sneekula

I like to create a structure in Python, something like: [code]solvent_name boiling_point melting_point flash_point [/code]I need to search and sort this structure. How can I best do that?

Member Avatar for jbennet
0
232

The End.