904 Posted Topics
![]() | Re: 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] |
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/ | |
Re: Your example answer is wrong. | |
Re: 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] = … | |
Re: 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 | |
Re: 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") # … | |
Re: 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 ''' | |
Re: 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 … | |
Re: cx_Freeze works with both versions of Python http://www.blog.pythonlibrary.org/2010/08/12/a-cx_freeze-tutorial-build-a-binary-series/ | |
| |
Re: Age is an issue of mind over matter. If you don't mind, it doesn't matter. (MT) | |
Re: 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 … | |
Re: 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' | |
| |
Re: 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 … | |
Re: Line 11 may give you error if you use Python3, change to: print(item) | |
I was trying to come up with a dictionary of functions, but get it not to work. | |
Re: 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) … | |
Re: Do what Microsoft does, create a new and improved version. | |
Re: If you ever have to maintain somebody else's program code, then goto's are one horror. | |
Re: Unfortunately the two bombers were Muslims, so there will be quite a bit of hatred going around. | |
Re: Luckily Henri and Henry are pronounced the same in America. | |
Re: I don't smoke, but you smokers please keep smoking so my Altria stock can pay the good dividend it does. | |
Re: 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; | |
Re: Try the Python dictionary with name:[age, weight, sex, ... ] pairs. | |
Re: 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 … |
The End.