904 Posted Topics

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
459
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
328
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
486
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
435
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
218
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
255
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
368
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
156
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
160
Member Avatar for daniel.king.39794
Member Avatar for bumsfeld
0
102
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
339
Member Avatar for aadarsh_khare
Member Avatar for JasonHippy
-1
276
Member Avatar for bumsfeld
Member Avatar for Kyss
0
238
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
238
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
522
Member Avatar for Xantipius
Member Avatar for vinnitro
-1
286
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
545
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
314
Member Avatar for jon92
Member Avatar for jon92
0
216
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

The End.