904 Posted Topics

Member Avatar for Reverend Jim

Steve Ballmer is stepping down because he is running MS into the ground with a lot of me-too ware and a management style of forced ranking. He most likely was not aware of the spy portion of Windows8.

Member Avatar for jwenting
0
265
Member Avatar for matthewwhite011

Children should be told to be in a sport rather than watch it. It takes a couch potato to raise a couch spud.

Member Avatar for Reverend Jim
0
962
Member Avatar for minitauros

I use Microsoft's SkyDrive and they give you 7GB free. Works well with the MS file manager.

Member Avatar for Reverend Jim
0
555
Member Avatar for aVar++

Here is a hint: sum3 = 0 for n in range(0, 1000, 3): #print(n) # test sum3 += n print(sum3)

Member Avatar for aVar++
0
133
Member Avatar for EriCartman13

pythondevguy do this: import random x = random.randint(1, 100) print(x) x = random.randint(1, 100) print(x)

Member Avatar for bumsfeld
-1
4K
Member Avatar for Klahr_R
Member Avatar for Klahr_R
1
279
Member Avatar for pythonforlife

Let's not forget that WxPython is just the wrapper for WxWindows which is written in C++. The wrapper seems to ignore the C++ error handling. It could have been done, but wasn't. I don't think there is any GUI toolkit that is written in pure Python, bummer. On the other …

Member Avatar for bumsfeld
0
460
Member Avatar for Judgment
Member Avatar for james.lu.75491856
Member Avatar for james.lu.75491856
Member Avatar for james.lu.75491856
Member Avatar for revellution

I use this little batch file to force IDLE to work with Python 3.1.1 [code=text]REM batch file to force IDLE to run with Python 3.1 REM save as IDLE31.bat C:\Python31\Pythonw.exe -u C:\Python31\Lib\idlelib\idle.pyw [/code] For discussion on 32bit versus 64bit see: [url]http://www.daniweb.com/forums/thread267106.html[/url]

Member Avatar for jordanrkaufman
0
460
Member Avatar for bumsfeld

In my journey to find a new programing language to learn, I found Nimrod. According to the spiel on its web page: "Nimrod combines Lisp's power with Python's readability and C's performance." Just curious to know if anbody here has used it? Nimrod's home is at: http://nimrod-code.org/

Member Avatar for rubberman
1
332
Member Avatar for Cducks
Member Avatar for Pallab.Bhk

Here is one example: import pprint as pp mydic = { 'a123': [1, 2, 2, 4], 'a124': [1, 2, 3, 4], 'a125': [1, 2, 2, 4], 'a126': [1, 2, 4, 5] } newdic = {} val_list = [] for key, val in mydic.items(): if val not in val_list: newdic[key] = …

Member Avatar for Pallab.Bhk
0
488
Member Avatar for Benkku

Or reverse your vector: import math p1 = (0.0, 0.0) p2 = (1.0, 1.0) # use vector from p2 to p1 dx = p2[0] - p1[0] dy = p2[1] - p1[1] angle = math.atan2(dy, dx) angle = math.degrees(angle) print(angle) # 45.0

Member Avatar for Gribouillis
0
441
Member Avatar for Matigo

You could potentially us a label as a spacer: try: # Python2 import Tkinter as tk except ImportError: # Python3 import tkinter as tk root = tk.Tk() root['bg'] = 'yellow' # use label as spacer, match background color spacer = tk.Label(root, width=20, bg='yellow') spacer.grid(row=1, column=1) button = tk.Button(root, text="Button1") # …

Member Avatar for bumsfeld
0
220
Member Avatar for Lardmeister

The other question is, does your hex string convert back to decimal? a = 255 hx = hex(a) print(hx) print(int(hx, 16)) hx = hex(a)[2:] print(hx) print(int(hx, 16)) ''' output --> 0xff 255 ff 255 '''

Member Avatar for bumsfeld
0
5K
Member Avatar for degarb

If you execute python.exe, it comes up with the black console window. If you execute pythonw.exe, nothing will show. It is used for GUI programs where the black console window would interfere. Actually, if you use one of the many IDE (like IDLE), to run your code, then you don't …

Member Avatar for bumsfeld
0
256
Member Avatar for Jacklittle01

cx_Freeze works with both versions of Python http://www.blog.pythonlibrary.org/2010/08/12/a-cx_freeze-tutorial-build-a-binary-series/

Member Avatar for vegaseat
0
370
Member Avatar for Xantipius
Member Avatar for Stuugie

Age is an issue of mind over matter. If you don't mind, it doesn't matter. (MT)

Member Avatar for BigPaw
0
439
Member Avatar for Jacklittle01

The Tkinter GUI toolkit's equivalent to raw_input() is the Entry widget. Here is an example: # simple Tkinter code # using two labels, an entry and a button # make tk the name space regardless of Python version try: # Python2 import Tkinter as tk except ImportError: # Python3 import …

Member Avatar for ZZucker
0
159
Member Avatar for krystosan
Member Avatar for happymadman

Since you are not passing any args, this will do: `self.bd4 = Tkinter.Button(self.frame, text="D4", command=self.roll_dice)` also self.sticky_all = 'ewns'

Member Avatar for bumsfeld
0
164
Member Avatar for daniel.king.39794
Member Avatar for bumsfeld
0
104
Member Avatar for dp121307

The reason your instructor is using cs1graphics module is so that outside people can not help you as easily as with common Tkinter GUI toolkit. Most likely your module is limited wrapper of Tkinter. A number of these Tkinter wrappers have appeared over the years, usually from folks that want …

Member Avatar for bumsfeld
0
341
Member Avatar for aadarsh_khare
Member Avatar for JasonHippy
-1
277
Member Avatar for bumsfeld
Member Avatar for Kyss
0
240
Member Avatar for tony75
Member Avatar for vegaseat

A somewhat updated version: ''' pyttsx_speech_test102.py speaks the present time in English, for instance "Sat Apr 27 15:10:59" as "Saturday April 27th 15 hours 10 minutes and 59 seconds" download pyttsx-1.1.tar.gz from https://pypi.python.org/pypi/pyttsx also needs setuptools-0.6c11.win32-py2.7.exe from https://pypi.python.org/pypi/setuptools#files install setuptools first then unpack the tar file and run (using Python27) …

Member Avatar for ZZucker
1
2K
Member Avatar for otengkwaku
Member Avatar for Koljik

If you ever have to maintain somebody else's program code, then goto's are one horror.

Member Avatar for Koljik
-1
240
Member Avatar for game06
Member Avatar for Octet

Unfortunately the two bombers were Muslims, so there will be quite a bit of hatred going around.

Member Avatar for Octet
0
523
Member Avatar for Xantipius
Member Avatar for vinnitro
-1
287
Member Avatar for Xantipius

I don't smoke, but you smokers please keep smoking so my Altria stock can pay the good dividend it does.

Member Avatar for mattster
-1
546
Member Avatar for ddannieellee

In Python3 you can specify the end of the print funtion: `print("hello", end='\n') # end='\n' is the default` Similar to C++ cout << "hello" << endl;

Member Avatar for HiHe
0
318
Member Avatar for jon92
Member Avatar for jon92
0
219
Member Avatar for debasishgang7

Another approach: ''' re_search_replace1.py replace second 'bad' with 'good' ''' import re s = 'bad1234567bad12345678bad123456789' print(s) # test m = re.search('bad', s) # apply slicing s1 = s[:m.end()] s2 = s[m.end():] print(s1) # test print(s2) # test s3 = s2.replace('bad', 'good', 1) print(s3) # test print(s1+s3) ''' bad1234567bad12345678bad123456789 bad 1234567bad12345678bad123456789 …

Member Avatar for bumsfeld
0
6K
Member Avatar for ALJ
Member Avatar for klickagent
0
9K
Member Avatar for gmorcan

Also be aware that in Python2 you might get an integer division unless you force a float: def average(q): ''' cast a float for Python2 ''' return float(sum(q))/len(q) q = [1, 2, 3, 4] avg = average(q) print(avg) # 2.5

Member Avatar for woooee
0
265
Member Avatar for mkweska

You can do it this way: class starfighter(): strength = 20 pilot = 55 intelli = 40 stamina = 35 print(starfighter.strength) # 20 print(starfighter.intelli) # 40

Member Avatar for Schol-R-LEA
0
219
Member Avatar for tony75

Python packs a lot of power, take a close look at this: from string import punctuation from collections import Counter data = """\ I love the python programming How love the python programming? We love the python programming Do you like python for kids? I like Hello World Computer Programming …

Member Avatar for tony75
0
504
Member Avatar for entropic3105
Member Avatar for lewisrs89

You also have to do your indentations properly: class Rectangle(object): def __init__(self, x, y): self.x = x self.y = y def area(self): return self.x*self.y def perimeter(self): return self.x*2 + self.y*2 def main(): print("Rectangle a:") a = Rectangle(5, 7) print("area: %d" % a.area()) print("perimeter: %d" % a.perimeter()) ''' print("") print("Rectangle b:") …

Member Avatar for bumsfeld
0
1K
Member Avatar for jaison2

Sounds like a fun project. My advice, do not hijack **old** solved threads, but start your own new thread, it's more polite and people are more willing to help. Give your new thread a meaningful title like "Making a stick figure class". Give us a hint what OS and Python …

Member Avatar for bumsfeld
0
10K
Member Avatar for Gubbei

I assume you are going to use the Python Image Library (PIL). Look at their documentation.

Member Avatar for bumsfeld
0
229
Member Avatar for ScarWars9

I like high tech gadgets, so I must be one geek. Even though some are nerdy gadgets too.

Member Avatar for entropic3105
0
334
Member Avatar for ajit.nayak3

Here is one well commented example: ''' data4_expand.py data4.csv looks like that: date,time,v1,v2 03/13/2013,11.23.10,12.3,3.4 03/13/2013,11.23.13,12.7,5.1 03/13/2013,11.23.16,15.1,8.3 03/13/2013,11.23.19,17.8,9.8 03/13/2013,11.23.22,19.6,11.4 03/13/2013,11.23.25,21.3,14.6 03/13/2013,11.23.28,24.2,18.3 ''' # read the csv file and process with open("data4.csv") as fin: data_list = [] for ix, line in enumerate(fin): # strip off trailing new line char line = line.rstrip() …

Member Avatar for bumsfeld
0
318

The End.