57 Solved Topics
Remove Filter 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. | |
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? | |
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. | |
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 … | |
There used to be a Python module called pyglet that allowed graphics and sound. I can't find it anywhere. | |
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] … | |
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 … | |
Just wondered which computer language is best suited for preteen students. Any ideas or experiences? | |
I need a function that returns True or False if an integer n is a prime. Any 'high speed' thoughts? | |
Is there a way to read Adobe PDF files with Python? | |
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? | |
Is there a reliable way to 'pluralize' english words with Python? | |
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. | |
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] | |
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, … | |
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 … | |
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 … | |
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': … | |
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 … | |
I want to see if a certain word is in a text file, how do I go about that? | |
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 … | |
How can I let the Tkinter Button command do more than one function? | |
How can I best find out how many times a word appears in a text? | |
I know that you can do integer calculation in Python with astronomically large numbers. What is the precision limit when using floats? | |
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? | |
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? | |
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? | |
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? | |
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? | |
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, … | |
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 … | |
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 … | |
I want to make a Tkinter button respond to a left and right mouse click differently. How can I do this? | |
How can I make a Tkinter window take up all my display screen area? | |
How can I best center a Tkinter window on my display screen? | |
I like to create a database of common chemicals with Python. How would I go about that? Any help welcome! | |
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. | |
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? | |
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 … | |
Is there a way to make a Tkinter GUI window that the user can not change the size of? | |
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 … | |
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. | |
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? | |
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? | |
I keep reading about endless loops, is that something you want or do you always have to control an endless loop situation? | |
Which Graphics User Interface (GUI) would you recommend for a beginner? I have seen some examples of Tkinter, wxPython and GTK. | |
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': … | |
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. | |
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 … ![]() | |
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? |
The End.