Forum: Geeks' Lounge 1 Day Ago |
| Replies: 21 Views: 606 When your black rim glasses are held together with white tape. |
Forum: Geeks' Lounge 1 Day Ago |
| Replies: 1,376 Views: 146,648 Pumpkin icecream (a real treat usually sold around Thanksgiving in the US). |
Forum: Python 1 Day Ago |
| Replies: 3 Views: 144 If you make the regular polygon a square with side length = 1.0, you should get an area of 1.0. A simple test to see if the area formula is correct. |
Forum: Python 1 Day Ago |
| Replies: 2 Views: 108 Do you want to move the ship around the screen? |
Forum: Python 1 Day Ago |
| Replies: 4 Views: 121 You can play with this ...
# test Python command line arguments
import sys
if (len(sys.argv) >= 2):
# skip sys.argv[0]
commandline_args = sys.argv[1:]
print( commandline_args ) |
Forum: Python 1 Day Ago |
| Replies: 2 Views: 150 If you have a dictionary in your program and want to save and later reload it as a dictionary object, you have to use module pickle. Here is an example ...
# use module pickle to save/dump and load... |
Forum: Python 1 Day Ago |
| Replies: 8 Views: 155 If you use Linux, be aware that filenames are case sensitive. |
Forum: Python 2 Days Ago |
| Replies: 5 Views: 151 A dictionary will serve you better ...
# create a large number of spheres referencing them
# with a (x, y):sphere_object dictionary pair
import visual as vs
spheres = {}
for x in range (0,... |
Forum: Geeks' Lounge 2 Days Ago |
| Replies: 672 Views: 74,996 M&M candies were originally made as a high-energy field snack for American soldiers in 1940. They were named after Forrest Mars and Bruce Murries, the inventors. |
Forum: Geeks' Lounge 2 Days Ago |
| Replies: 143 Views: 8,812 It is a beggar's pride that he is not a thief.
-- Thai Proverb |
Forum: Geeks' Lounge 2 Days Ago |
| Replies: 143 Views: 8,812 If my shirt knew my design, I'd burn it.
-- Korean Proverb |
Forum: Geeks' Lounge 2 Days Ago |
| Replies: 143 Views: 8,812 An accomplishment sticks to a person.
-- Japanese Proverb |
Forum: Geeks' Lounge 2 Days Ago |
| Replies: 21 Views: 606 When the can of frozen Orange juice says "Concentrate" and you do. |
Forum: Geeks' Lounge 2 Days Ago |
| Replies: 1,376 Views: 146,648 Eggs, sunny side up, toasted English muffin with plum jelly. |
Forum: Python 2 Days Ago |
| Replies: 3 Views: 106 Study up on regex then ...
http://www.amk.ca/python/howto/regex/
Give attention to section Search and Replace |
Forum: Python 2 Days Ago |
| Replies: 7 Views: 221 Then you do something like this ...
# search the http://python.org html code for all the
# <a tag lines that have a title with the word Python in it
import re
import urllib
from BeautifulSoup... |
Forum: Python 3 Days Ago |
| Replies: 8 Views: 240 I assume your error is here ...
def print_list(names):
print 'Here are the names in the original order:'
for names in name_list: # <--------
print names
names.sort()
... |
Forum: Python 3 Days Ago |
| Replies: 9 Views: 224 Python3 will tolerate adding (object) to your class for a while at least.
After that just write a little Python utility that removes it. |
Forum: Python 3 Days Ago |
| Replies: 4 Views: 163 Here is the story:
In Python2 Tkinter is a Python module file named Tkinter.py a wrapper for the TCL code Tkinter is written in.
With the advent of Python3 Tkinter became a more modern package... |
Forum: Python 3 Days Ago |
| Replies: 6 Views: 207 If you want to start with the population after 1/2 year, then every year you have to change your code to this (Python2 or Python3) ...
def populationGrowth():
x = int(input("What is the current... |
Forum: Python 3 Days Ago |
| Replies: 7 Views: 221 If you have very large HTML documents you have the option to parse only selected parts of the document. Here is an example (Python2 code) ...
import urllib
from BeautifulSoup import BeautifulSoup,... |
Forum: Python 3 Days Ago |
| Replies: 5 Views: 153 In this case you have to create a new parent frame (size it for the image) for wx.StaticBitmap(frame, wx.ID_ANY, image)
Would be nice if I could test it out, but I simply don't have all the... |
Forum: Python 3 Days Ago |
| Replies: 5 Views: 153 Try something like this ...
#plt.show()
plt.savefig("test.png")
# create an internal image
image = wx.Bitmap("test.png")
# show the image as static... |
Forum: Geeks' Lounge 4 Days Ago |
| Replies: 1,376 Views: 146,648 An almond butter and boysenberry jam sandwich, cup of hot lemon tea. |
Forum: Python 4 Days Ago |
| Replies: 5 Views: 181 Why don't you just run the sample code I gave you with the image_file = "mars.jpg" and make sure you have the image file in the working directory or give it the full path.
Avoid the crap you added... |
Forum: Python 4 Days Ago |
| Replies: 9 Views: 246 The C function getch() will return a byte string in Python3, so you have to decode it.
Something like that ...
# windows console only
# C:\Windows\System32\msvcrt.dll contains C functions
... |
Forum: Python 4 Days Ago |
| Replies: 5 Views: 184 First of all, do not call your function sum because there is already a built-in Python function sum() that will sum up the numbers in a numeric list. This also gives you the hint how to solve your... |
Forum: Python 4 Days Ago |
| Replies: 3 Views: 135 Which graphics module are you using? |
Forum: Python 4 Days Ago |
| Replies: 2 Views: 214 Use something like that ...
s = "My Title"
width = 70
s = s.center(width)
print( s ) |
Forum: Python 4 Days Ago |
| Replies: 5 Views: 192 If you use Python3, then you can display what range(1, 10) iterates over with this ...
print( list(range(1, 10)) ) |
Forum: Python 4 Days Ago |
| Replies: 5 Views: 184 os.path.exists(filename) will return True or False. |
Forum: Python 4 Days Ago |
| Replies: 4 Views: 225 For tuples, lists, dicts...etc take a looky at this:
http://www.swaroopch.com/notes/Python_en:Data_Structures |
Forum: Python 4 Days Ago |
| Replies: 9 Views: 246 In general, one ought to avoid platform specific code with a cross platform language like Python. |
Forum: Python 4 Days Ago |
| Replies: 5 Views: 181 Pygame can load quite a number of image formats. Here is an example ...
# experiments with module pygame
# free from: http://www.pygame.org/
# load and display an image using pygame
import... |
Forum: Python 4 Days Ago |
| Replies: 6 Views: 181 Ah, simple enough, so ...
mouse_position = win.getMouse() |
Forum: Python 4 Days Ago |
| Replies: 7 Views: 221 BeautifulSoup is a third party module for Python2 that allows you to access even badly coded HTML code. What do you want to do with it? |
Forum: Python 4 Days Ago |
| Replies: 5 Views: 170 I trust that by now you have figured out that names in Python are case sensitive. |
Forum: Python 4 Days Ago |
| Replies: 2 Views: 163 Don't worry about adding (object) right now. It is only needed in special cases, and that need is gone in Python3 anyway. Here is an example class that should explain some of your questions ...... |
Forum: Python 5 Days Ago |
| Replies: 6 Views: 181 I am sure somewhere in the graphics.py documentation is a function to get the x, y position of the mouse click.
In Tkinter it is tied to the click event via event.x and event.y |
Forum: Python 5 Days Ago |
| Replies: 1 Views: 133 For Windows7 gadgets you might have to wait for the new wxPython. |