1,175 Posted Topics

Member Avatar for TheOneElectroni

Will something like this do? [code=python]import Tkinter as tk def set_text_newline(s): """start text s on a new line""" text1.insert(tk.INSERT, '\n' + s) root = tk.Tk() # width=width characters, height=lines of text text1 = tk.Text(root, width=50, height=12, bg='yellow') text1.pack() set_text_newline("line one") set_text_newline("line two") set_text_newline("line three") root.mainloop() [/code]

Member Avatar for TheOneElectroni
0
4K
Member Avatar for kasunc

Something like this could do it: [code=python]mystr = 'Hello everybody. Some times THERE ARE upper case words' mylist = mystr.split() #print mylist newstr = '' for word in mylist: if word[0].isupper(): word = word.capitalize() newstr += word + ' ' print newstr """ my output --> Hello everybody. Some times …

Member Avatar for kasunc
0
296
Member Avatar for itdupuis

Talking to my physics professors and fellow students, lithium ion battery electric cars or compressed air powered cars are much more feasible than hydrogen cars. They use electricity more directly. Hydrogen fuel is a convenient buzzword for politicos. An easy thing to sell to an uneducated public. Oh, we have …

Member Avatar for Ene Uran
0
159
Member Avatar for Wumbate

If you would write range() in Python you would have to do something like this: [code=python]def range(start, stop=None, step=1): """if start is missing it defaults to zero, somewhat tricky""" if stop == None: stop = start start = 0 # rest of the code here ... [/code]

Member Avatar for woooee
0
157
Member Avatar for marcosjp

When you make matriz global to the class it just keeps appending to it. Change your code this way: [code=python]# Square matrix import random class Matriz: """Math operations with matrixes""" #matriz = [] # don't make this global!!!! grau_matriz = 0; def __init__ (self, grau_matriz, inicio): self.grau_matriz = grau_matriz #Decides …

Member Avatar for marcosjp
0
154
Member Avatar for wowimbored

I streamlined your code a little: [code=python]import random print "Enter 3 integer numbers and i'll choose 1 at random" while True: a = input("first number? ") b = input("second number? ") c = input("third number? ") # put your numbers in a list nmlist = [a, b, c] if type(a+b+c) …

Member Avatar for wowimbored
0
81
Member Avatar for puliamrm

On your class and Tkinter GUI code, I would recommend that you first get your feet wet on some smaller sample code. As it is now, it makes not much sense.

Member Avatar for sneekula
0
98
Member Avatar for s7plc

In this case you are better off to use just Python. Actually, regular expressions aren't necessarily faster. I added plenty of comments to help you: [code=python]ts = 'xyz abc mno def' # separate at space to create a list space = ' ' qs = ts.split(space) # search for these …

Member Avatar for sneekula
0
6K
Member Avatar for The Dude
Member Avatar for R0bb0b
0
382
Member Avatar for sorno

Vista is a bitch isn't it? If I get a chance, I will try it on my friends Vista box.

Member Avatar for sneekula
0
124
Member Avatar for Lardmeister

[QUOTE=Ancient Dragon;621781]Of course that is true -- In the USA they are called senators, congressmen, and lobbyists.[/QUOTE]Nope, they are called moneybag bankers.

Member Avatar for techbound
1
83
Member Avatar for lllllIllIlllI
Member Avatar for lllllIllIlllI
0
68
Member Avatar for Lardmeister

I find that PyScripter is more ornary with errors on Widows Vista than it is on Windows XP. Might be the OS that causes the problem. Look at the popup window title when it it is forced to shut down under Vista! It is an OS window not a PyScripter …

Member Avatar for sneekula
0
133
Member Avatar for lllllIllIlllI

Here is a wxPython tutorial that I have used: [url]http://wiki.wxpython.org/index.cgi/AnotherTutorial[/url]

Member Avatar for lllllIllIlllI
0
549
Member Avatar for DustinS

The Python function eval() will take a string and try to evaluate/interpret it. BTW, the PyScripter IDE allows you to interpret your source code without having to create an official file. I hate the Python shell, it's okay for one liners only! If I were stranded on an island and …

Member Avatar for DustinS
0
7K
Member Avatar for inkcoder

First, welcome to the forum! What 'slate' is really telling you is that input() is for numbers and raw_input() is for strings. Using input() has certain risks since you can also enter a command and it will excute it. Anyway, if you want to use op = input(">") then op …

Member Avatar for sneekula
0
178
Member Avatar for olipals

Fuse, very nice code ad explanation! Python has a few string functions that make your code even easier. Simply use line.rstrip(). The default removes any trailing whitespace characters like '\n': [code=python]line = '0.00\t2.869e-12\t7.715e-08\t0.000e+00\t0.000e+00\n' # remove any trailing whitspace characters (default) line = line.rstrip() line_list = line.split('\t') print line_list # ['0.00', …

Member Avatar for sneekula
0
273
Member Avatar for dinilkarun

On Windows you are looking for is a DLL called pyuno.dll. On my installation it is in: C:\Program Files\OpenOffice.org 2.4\program\ You may have to copy that DLL into a folder mentioned in PYTHONPATH, so Python can find it, or you can start your program with: [code=python]import sys # appends to …

Member Avatar for sneekula
0
76
Member Avatar for lllllIllIlllI

It would be nice to have an actual example of the HTML source code or at least the web site's URL. As Jeff said, the BeautifulSoup module (an HTML scraper) is great, but a has a steep learning curve. An interesting project, so let us know any progress.

Member Avatar for bumsfeld
0
106
Member Avatar for Praymus

There are a few things the frame builder does not do, you have to do those in the Boa editor yourself. Here is an example: [code=python]#Boa:Frame:Frame1 import wx import wx.grid def create(parent): return Frame1(parent) [wxID_FRAME1, wxID_FRAME1GRID1, ] = [wx.NewId() for _init_ctrls in range(2)] class Frame1(wx.Frame): def _init_ctrls(self, prnt): # generated …

Member Avatar for bumsfeld
0
229
Member Avatar for The Dude
Member Avatar for jephthah
0
263
Member Avatar for majestic0110

There a re so many pretty girls knocking at my door all the time, I would like 24 hours without them.

Member Avatar for sneekula
0
262
Member Avatar for GrimJack

I have never seen Carl Rove on Fox News, but he should fit right into the motley crew of characters there. With a face like that what would you expect to come out of it! I watch the Fox News Channel, get my laughs, and leave before permanent brain damage …

Member Avatar for sneekula
0
132
Member Avatar for mattyd
Member Avatar for ~s.o.s~
3
10K
Member Avatar for sam_only96

Welcome to the often childish world of Vista's enhanced security. The latest stable release (build 210) is dated September 22, 2006, most likely pre Vista. You could post this question on: [url]http://python.net/crew/mhammond/win32/FAQ.html[/url]

Member Avatar for sneekula
0
38
Member Avatar for afi88

rJ[i,1] is a float and most like never exactly equal to zero, but within a narrow range of zero.

Member Avatar for sneekula
0
134
Member Avatar for ssDimensionss

Python has a module csv that will make your life easier handling csv files.

Member Avatar for bvdet
0
180
Member Avatar for kdoiron

You are not the only one, python-forum.org comes up sickly and unusable. Judging from past periods of administrative neglect, this may take a long time to fix. Wonder where 7stud went to?

Member Avatar for Ferroman
0
144
Member Avatar for maui_mallard
Member Avatar for jbennet
2
311
Member Avatar for dise652
Member Avatar for DangerDev

[QUOTE=Lardmeister;528869]Well, it's a market. Some other stall offers cheaper goods, people will buy there. That's about all the logic there is.[/QUOTE]Not totally true, in this market you most often have to sell something first before you can buy.

Member Avatar for sneekula
0
582
Member Avatar for rodG

Your initial problems stem from the fact that you are mixing tabs and spaces in your indentations. It really loused up the code on my editor. Stick with spaces (4) only! Also, when you click the stop button during sleep(1), it most likely will not respond. You may need to …

Member Avatar for rodG
0
4K
Member Avatar for lllllIllIlllI

If you are using Windows you can do this: [code=python]# get the character of a key pressed (no return key needed) # works only in the command window and with Windows OS from msvcrt import getch print "press a char key (escape key to exit)" while True: z = getch() …

Member Avatar for a1eio
0
8K
Member Avatar for The Dude

When I grow up I would like to be more like my hero, the actor and writer James Earl Jones. I have to practice on my deep voice though.

Member Avatar for twomers
-1
293
Member Avatar for disraeli

In your case I would worry a lot. If your wife gets interested in computer programming, she could turn into a 'computer nun' and totally neglect you! BTW, your wife wouldn't be a chain saw enthusiast, would she?

Member Avatar for jbennet
0
250
Member Avatar for s_jmp

If your code gets a little longer and more complex, you need to establish a namespace for the different imported functions. It helps you understand the code better and avoids collisions. For instance Tkinter and PIL both have Image. For example, to save on typing I always use: [code]import Tkinter …

Member Avatar for sneekula
0
158
Member Avatar for briansmall

My passion is cars. I always have the hood up fixing something. Of course, all I can afford is some old clunker.

Member Avatar for ZZucker
0
560
Member Avatar for The Dude

The Flintstones and Jetsons were neat, looking into the past and the future as only cartoons could do. Love those reruns and old DVDs.

Member Avatar for Sulley's Boo
0
104
Member Avatar for saskvach

You could do one on volumes and surface area calculations of boxes, cylinders, spheres, or cones.

Member Avatar for saskvach
0
61
Member Avatar for enigmaenigma

It could be as simple as this: [code=python]text = """\ Hello all. I have a text file which has a number of links ... """ html = "<title></title><html><body>" + text + "</body> </html>" print html fout = open("test_html.htm", "w") fout.write(html) fout.close() [/code]

Member Avatar for sneekula
0
85
Member Avatar for bf2loser

Somewhere in your loop you have to build up your encrypted phrase. Also, a phrase will contain spaces, so you need to take care of that.

Member Avatar for bf2loser
0
111
Member Avatar for DoctorBob
Member Avatar for pazoo

Please use code tags with your code to preserve the indentations. Otherwise the code is very difficult to read and not too many folks will help. [noparse][code=python][/noparse] your Python code here [noparse][/code][/noparse]

Member Avatar for pazoo
0
119
Member Avatar for P.Bateman

Please use code tags with your code to preserve the indentations. Otherwise the code is very difficult to read and not too many folks will help. [noparse][code=python][/noparse] your Python code here [noparse][/code][/noparse] This code will not work: [code]if response == "yes" or "OK" or "Yes" or "ok": [/code]I has to …

Member Avatar for P.Bateman
0
157
Member Avatar for The Dude
Member Avatar for The Dude

I grew up in a very poor neighborhood and went to a very poor public school in the Detroit area. Most of my education I got from my uncle who was a professor at the University of Detroit. This way I didn't have to learn to squirt milk out of …

Member Avatar for twomers
0
117
Member Avatar for zandiago

@briansmall: Well thought out! One subject that does not fit one liners. Darn, and I like those.

Member Avatar for jbennet
0
862
Member Avatar for kv79
Member Avatar for GrimJack

Some people in the US sit in front of a turned off TV and find it more entertaining than turning it on.

Member Avatar for GrimJack
0
132
Member Avatar for linux

Let's see if I understand that right: [code]A |:---------------| Bb |-[]-------------| C |----------------| Db |---:------------| D |----[--]--------| Eb |--------::------| E |----------::----| F |------------::--| Gb |----------------| G |----------------| [/code]Where the ':' is a certain instrument from a wave file would play that note?

Member Avatar for Ene Uran
0
85

The End.