1,175 Posted Topics
Re: I am using Clisp free from: [URL]http://sourceforge.net/projects/clisp/[/URL] [php] (format t "~%~S from DaniWorld!~%" "Hello world") [/php] | |
Re: I think your print to the display will be by far the slowest operation. | |
![]() | Re: There is 'Starting Python' right here to give you a taste: [URL]http://www.daniweb.com/techtalkforums/thread20774.html[/URL] A good starter tutorial: [URL]http://bembry.org/technology/python/index.php[/URL] Another good starter tutorial: [URL]http://www.ibiblio.org/g2swap/byteofpython/read/[/URL] And of course there is always the latest update: [URL]http://www.python.org/doc/current/tut/tut.html[/URL] Now watch out, Python takes an open mind and is addictive! |
Re: You figured it out! [code=python] print 011 # --> 9 (the denary for octal 011) print 0xff # --> 255 (the denary of hex ff) [/code] | |
Re: I think there is a logic flaw in either code, since you are not using the result of the recursion call. It seems to pile up in a return stack somewhere! If you uncomment Bumsfeld's internal print statement, it will print a whole bunch (counted 31) of sixes | |
Re: Take a look at: [URL]http://bembry.org/index.php[/URL] | |
I want to see if a certain word is in a text file, how do I go about that? | |
Re: One of your problems is right here: [code] if (winsA) or (winsB) == ((n / 2) + 1): break [/code]You have to change the if statement logic a bit, and you are using break when you are clearly not in a loop. | |
Re: I didn't have a file, so I used just a text string for testing, but here is one way you can solve this: [code=python]text = "I love to work, but not paying my taxes!" # text to word list words = text.split() print words # testing the word list # … | |
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? | |
Re: I was just playing around with a matrix the other day and found out this: [code=python]# create a 10 x 10 matrix of zeroes matrix10x10 = [[0 for col in range(10)] for row in range(10)] # fill it with 1 diagonally for i in range(10): matrix10x10[i][i] = 1 # show … | |
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? | |
Re: You also complicate your code (and life) by switching to OOP, when python gives you the freedom not to do that with simple programs like that. | |
How would one create a simple spreadsheet with Tkinter? | |
This could be a cooking recipe, but in my case it is a chemical recipe. Here is a typical generic chemical recipe: 23 g chemicalA is dissolved in 250 ml methanol. The solution is cooled to 0 - 5 degC and 18 ml compoundB is added dropwise over 60 minutes. … | |
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? | |
Re: [quote=Infarction;313071]I'd go the other way (int to char) so you don't lose data if the int value is >= 256...[/quote]You could use RUBY then you don't have to worry about silly issues like that. | |
Re: You can also use module numpy: [php]import numpy v1 = numpy.array([1, 2, 3, 4]) v2 = numpy.array([4, 3, 2, 1]) # product print v1*v2 # [4 6 6 4] # scalar product print numpy.add.reduce(v1*v2) # 20 [/php]Numpy is a free high speed numeric extension module used by engineers and scientists. | |
Re: This re stuff makes my head spin! I can see that it is very powerful for text processing, but also seemingly very complex! Almost another language within Python. | |
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? | |
Re: [quote=Matt Tacular;306575]In python if I divide 6/3 I get 2, that's fine. But I divide 6/4 and get 1... Why aren't I getting a decimal? I would like to know because I want to make something that can detect wether or not a number is whole. (I need help with … | |
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? | |
Re: [quote=vegaseat;302724]Looks like Ghostdog is right ... [code=Python]# test sample from user input months = ['Dec', 'Jan'] # test sample from os.path.walk() files = ['FebWork1,dat', 'JanWork3.dat', 'DecWork7.dat'] # test dates = [] for i in files: for j in months: if j in i: dates.append(i) break print dates # ... or … | |
Re: I your interest should be in chemistry, write a chemical structure drawing program, that displays bondenergies and charge intensities of the molecule. | |
Re: I have used DrPython for a while now and really like it! Comes in Windows and Linux versions. It has clean displays and a minimum of quirks (does not like foreign characters). There are lots of configuration options. The results are displayed in an output window, and you can select … | |
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 do you best swap the key:value pair of a dictionary? | |
How can I make a Tkinter window take up all my display screen area? | |
Re: [quote=Ene Uran;289138]Also a word of advice: 1) start your class names with a capital letter 2) create class instances like: main = Main(root) child = Child() 3) now you can get rid of the globals by associating the variables properly to the class instance via self. or the instance name.[/quote]Maybe … | |
| |
Re: As far as I know in the US all the states and capitals are unique. Since your are entering the state and want to find that capital, Ene's solution will be the easiest. | |
How can I best center a Tkinter window on my display screen? | |
Re: So, how did you solve the problem? BTW, I really enjoyed reading your blogs! | |
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? | |
Re: I agree with Jeff! I have seen other computer language code like C, where the writer did not not use any indentation. Now you get lost in an ocean of { and } and ; which makes large code almost unreadable! | |
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 … |
The End.