bumsfeld 413 Nearly a Posting Virtuoso
jonsca commented: Rep for keeping this thread going +0
Salem commented: <wopr>would you like to play a game</wopr> +0
What does your code look like?
Try to write your code files and run them from the IDE that comes with the Python installation (called IDLE). The IDE will connect the working directory (where your code file is located) with Python.exe
I thought that 12/21/2012 was the time when planetary arrangements made the sun real eager for sun spots.
Not much damage done compared to world leaders that don't know anything about the world.
Polymorphism ---
Behavior of an "object" is determined at run-time
and depends on what kind/type of object it is:
# for instance x * y
x = 2; y = 3; print x * y # 6
# but ...
x = 'A'; y = 3; print x * y # AAA
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.
[code]
your Python code here
[/code]
Something like this?
# plot of log line
from tkinter import *
import math
def particleCount(decay, p0, time):
p = (p0*math.e)**(-(decay*time))
return (p)
# define root window
root = Tk()
root.title("Radioactive Decay Graph")
# create frame to put control buttons onto
frame = Frame(root, bg='grey', width=400, height=40)
frame.pack(fill='x')
button1 = Button(frame, text='Button1')
button1.pack(side='left', padx=10)
button2 = Button(frame, text='Button2')
button2.pack(side='left')
# set canvas properties
width = 400
height = 400
center = height*(5/6)
x_increment = 1
# invoke canvas
c = Canvas(root, width=width, height=height, bg='black')
c.pack()
# add string
str1 = "Logarithmic decay graph"
c.create_text(10, 20, anchor=SW, text=str1)
# line width stretch
x_factor = 1
# line height stretch
y_amplitude = -300
center_line = c.create_line(0, center +1, width, center+1, fill='green')
coordinates = []
coord = []
for x in range(0, 600):
# x coordinates
coord.append((x * x_increment) * x_factor)
# y coordinates
y = particleCount((1.16*(10**-3)), (5*(10**6)), x)
coord.append((y * y_amplitude) + center)
coordinates.append(coord)
coord = []
log_line = c.create_line(coordinates, fill='red')
root.mainloop()
It's probably easier to pull the data you need for plotting out of a list:
raw_data = """\
google.com {'facebook.com': 230, 'yahoo.com': 9, 'fifa.org': 67, 'msn.com': 3}
yahoo.com {'apps.facebook.com': 13, 'msn.com': 9, 'myp2p.eu': 2}"""
filename = "aadata.txt"
# save to test file
fout = open(filename, "w")
fout.write(raw_data)
fout.close()
# read the test file line by line and process
# save each line list in data_lines list
data_lines = []
for line in open(filename):
line = line.rstrip()
# remove the following characters
line = line.replace('{', '')
line = line.replace('}', '')
line = line.replace(':', '')
line = line.replace(',', '')
line = line.replace('\'', '')
#print line, type(line) # test
print line.split()
data_lines.append(line.split())
'''my result -->
['google.com', 'facebook.com', '230', 'yahoo.com', '9', 'fifa.org', '67', 'msn.com', '3']
['yahoo.com', 'apps.facebook.com', '13', 'msn.com', '9', 'myp2p.eu', '2']
'''
Which version of Windows are you using?
PyQT 4.8 seems to work better with Windows7 than Windows XP
Use matplot from:
http://sourceforge.net/projects/matplotlib/files/matplotlib/
You can modify the example from:
http://matplotlib.sourceforge.net/examples/api/barchart_demo.html
You can also do string slicing:
s = 'hello'
print(s[:1]) # h
# more
print(s[:2]) # he
print(s[:4]) # hell
Lardmeister: very smart, very young
Ancient Dragon: very smart, very old
It is the Earth's magnetic field that protects its atmosphere from being blown away by solar winds. However the magnetic field has declined by 6% in the last 100 years.
A Programmer and an Engineer were sitting next to each other on an airplane. The Programmer leans over to the Engineer and asks if he wants to play a fun game. The Engineer just wants to sleep so he politely declines, turns away and tries to sleep. The Programmer persists and explains that it's a real easy game. He explains, "I ask a question and if you don't know the answer you pay me $5. Then you ask a question and if I don't know the answer I'll pay you $5." Again the Engineer politely declines and tries to sleep.
The Programmer, now somewhat agitated, says, "O.K., if you don't know the answer you pay me $5 and if I don't know the answer I pay you $50! " Now, that got the Engineer's attention, so he agrees to the game. The Programmer asks the first question, "What's the distance from the earth to the moon?" Then Engineer doesn't say a word and just hands the Programmer $5.
Now, it's the Engineer's turn. He asks the Programmer, "What goes up a hill with three legs and comes down on four?" The Programmer looks at him with a puzzled look, takes out his laptop computer, looks through all his references and after about an hour wakes the Engineer and hands the Engineer $50. The Engineer politely takes the $50 turns away and tries to return to sleep.
The Programmer, a little miffed, asks, "Well what's the answer to …
These two strings walk into a bar and sit down.
The bartender says, "So what'll it be?"
The first string says, "I think I'll have a beer quag fulk boorg jdkCjfdLk jk3s d#f67howeU r89nvyowmc63Dz x.xvcu"
"Please excuse my friend," the second string says, "He isn't null-terminated."
Portabella Mushroom soup and homemade French Bread. Nice for the cold weather here.
Jennifer Aniston is interesting and talented
You can design rather simple calculator using the Python function eval():
# simple calculator using Python function eval()
# improvements:
# safeguard eval(), error check math expression
# loop for more calculations and so on
#
# importing math functions allows you to enter sin(1.6), pi etc.
from math import *
# for Python3 use input()
exp = raw_input("Enter math expression (eg. 12*12-4): ")
print(eval(exp))
Rice pudding with fresh ground cinnamon.
At least your posts contain substance.
Got this error when I posted the above:
Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 4864 bytes) in /home/daniweb/httpdocs/forums/includes/class_bbcode.php(172) : eval()'d code on line 66
The only example I could find was this one ...
'''
Python31 includes the Tkinter Tile extension Ttk.
Ttk comes with 17 widgets, 11 of which already exist in Tkinter:
Button, Checkbutton, Entry, Frame, Label, LabelFrame, Menubutton,
PanedWindow, Radiobutton, Scale and Scrollbar
The 6 new widget classes are:
Combobox, Notebook, Progressbar, Separator, Sizegrip and Treeview
'''
import tkinter as tk
import tkinter.ttk as ttk
root = tk.Tk()
img1 = tk.PhotoImage("frameFocusBorder", data="""
R0lGODlhQABAAPcAAHx+fMTCxKSipOTi5JSSlNTS1LSytPTy9IyKjMzKzKyq
rOzq7JyanNza3Ly6vPz6/ISChMTGxKSmpOTm5JSWlNTW1LS2tPT29IyOjMzO
zKyurOzu7JyenNze3Ly+vPz+/OkAKOUA5IEAEnwAAACuQACUAAFBAAB+AFYd
QAC0AABBAAB+AIjMAuEEABINAAAAAHMgAQAAAAAAAAAAAKjSxOIEJBIIpQAA
sRgBMO4AAJAAAHwCAHAAAAUAAJEAAHwAAP+eEP8CZ/8Aif8AAG0BDAUAAJEA
AHwAAIXYAOfxAIESAHwAAABAMQAbMBZGMAAAIEggJQMAIAAAAAAAfqgaXESI
5BdBEgB+AGgALGEAABYAAAAAAACsNwAEAAA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zCFCh1QH5jQIW3xugwSzD4QvIIH
4s/PUgiQYcCG4BkC5P/ObpaBhwreq18nb3Z79+8Dwo9nL9I8evjWsdOX6D59
fPH71Xeef/kFyB93/sln4EP2Ebjegg31B5+CEDLUIH4PVqiQhOABqKFCF6qn
34cHcfjffCQaFOJtGaZYkIkUuljQigXK+CKCE3po40A0trgjjDru+EGPI/6I
Y4co7kikkAMBmaSNSzL5gZNSDjkghkXaaGIBHjwpY4gThJeljFt2WSWYMQpZ
5pguUnClehS4tuMEDARQgH8FBMBBBExGwIGdAxywXAUBKHCZkAIoEEAFp33W
QGl47ZgBAwZEwKigE1SQgAUCUDCXiwtQIIAFCTQwgaCrZeCABAzIleIGHDD/
oIAHGUznmXABGMABT4xpmBYBHGgAKGq1ZbppThgAG8EEAW61KwYMSOBAApdy
pNp/BkhAAQLcEqCTt+ACJW645I5rLrgEeOsTBtwiQIEElRZg61sTNBBethSw
CwEA/Pbr778ABywwABBAgAAG7xpAq6mGUUTdAPZ6YIACsRKAAbvtZqzxxhxn
jDG3ybbKFHf36ZVYpuE5oIGhHMTqcqswvyxzzDS/HDMHEiiggQMLDxCZXh8k
BnEBCQTggAUGGKCB0ktr0PTTTEfttNRQT22ABR4EkEABDXgnGUEn31ZABglE
EEAAWaeN9tpqt832221HEEECW6M3wc+Hga3SBgtMODBABw00UEEBgxdO+OGG
J4744oZzXUEDHQxwN7F5G7QRdXxPoPkAnHfu+eeghw665n1vIKhJBQUEADs=""")
style = ttk.Style()
style.element_create("RoundedFrame", "image", "frameBorder",
("focus", "frameFocusBorder"), border=16, sticky="nsew")
style.layout("RoundedFrame", [("RoundedFrame", {"sticky": "nsew"})])
style.configure("TEntry", borderwidth=0)
frame = ttk.Frame(style="RoundedFrame", padding=10)
frame.pack(fill='x')
frame2 = ttk.Frame(style="RoundedFrame", padding=10)
frame2.pack(fill='both', expand=1)
entry = ttk.Entry(frame)
entry.pack(fill='x')
entry.bind("<FocusIn>", lambda evt: frame.state(["focus"]))
entry.bind("<FocusOut>", lambda evt: frame.state(["!focus"]))
text = tk.Text(frame2, borderwidth=0, bg="white", highlightthickness=0)
text.pack(fill='both', expand=1)
text.bind("<FocusIn>", lambda evt: frame2.state(["focus"]))
text.bind("<FocusOut>", lambda evt: frame2.state(["!focus"]))
root.mainloop()
Looks menacingly complex!
I like Tic Tac Toe
Give a man a fish, and you have fed him for today. Teach a man to fish, and you can sell him fishing equipment for the rest of his life.
They should get at least B+ grade for ingenuity!
I would like to know if anyone knows the date that asselin.com was aquired by Hover. Also, who started asselin.com and where would I go to find out this information.
Thanks,
Jerry W.
IOI, Inc.
Are you looking for work?
Beef on rice noodles with nice red wine.
Airport screening simplified!
Provide a booth that each person can step into, that will not X-ray the person, but will detonate any explosive device the person may have on him/her.
There would be none of this crap about racial profiling and this method would eliminate a long and expensive trial.
Very funny! Would be useful gadgetry!
Need gadget that makes the sun shine at night when we would need the light.
In Python3 input() will give you string. You can use eval(input()) to get numbers, but I would make sure that the string you are using with eval() does not contain any nasty commands.
Simply run PIL-1.1.7.win32-py2.6.exe it installs itself.
Here you go:
# tested with Python 3.1.1
import fractions
a = 10
b = 25
cd = fractions.gcd(a, b)
sf = "the greatest common divisor of the integers %d and %d is %d"
print( sf % (a, b, cd) )
"""my result
the greatest common divisor of the integers 10 and 25 is 5
"""
If you have a Windows machine and Python26, simply download and install:
PIL-1.1.7.win32-py2.6.exe
Toggle images with the Tkinter GUI toolkit:
# Tkinter toggle images ...
import Tkinter as tk
from PIL import ImageTk
def toggle_image(toggle=[False]):
if toggle[0]:
label.config(image=image1)
toggle[0] = False
else:
label.config(image=image2)
toggle[0] = True
root.update()
root = tk.Tk()
root.config(bg='yellow')
# create all image objects in __main__ to be persistent
# pick images you have in the working folder or give full path ...
image1 = ImageTk.PhotoImage(file='redbtn.jpg')
image2 = ImageTk.PhotoImage(file='bluebtn.jpg')
label = tk.Label(root, image=image1)
label.grid(row=1, column=1, padx=20)
button = tk.Button(root,text='toggle image', command=toggle_image)
button.grid(row=2, column=1)
root.mainloop()
You can use the class instance as key:
class RedKey(pygame.sprite.Sprite):
image = None
count = 0
def __init__(self, location):
pygame.sprite.Sprite.__init__(self)
if self.image is None:
self.image = pygame.image.load("red_key.png").convert_alpha()
if self.count > 0:
self.rect = self.image.get_rect()
self.rect.topleft = location
# more of your code here
...
location = ... # pick your location
# create instance of class
red_key = RedKey(location)
# more of your code here
...
item_dictionary.clear()
if red_key.count > 0:
item_dictionary[red_key] = red_key.count
You are using the Python shell.
>>> f = open ('myflie.txt', 'w')
>>> f.write ('12345')
5
The Python shell is for testing of short code ideas. Use the editor to write programs.
This is the way I installed PyQt on my Windows XP machine and it works fine.
For Python26 download (latest versions as of 4/3/2010):
python-2.6.5.msi
Windows installer from
http://www.python.org/download/releases/2.6.5/
PyQt-Py2.6-gpl-4.7.2-1.exe
Windows installer from
http://www.riverbankcomputing.co.uk/software/pyqt/download
This was my little test program:
# pqt_Slider_LCD.py
# create PyQt form with slider and LCD readout
# get changing slider values for potentially other uses
# for easier syntax import this way
from PyQt4.QtCore import *
from PyQt4.QtGui import *
class MyForm(QWidget):
def __init__(self, parent=None):
QWidget.__init__(self, parent)
self.setWindowTitle('show slider value')
self.resize(250,150)
self.lcd = QLCDNumber(self)
# default slider values are 0 to 99
self.slider = QSlider(Qt.Horizontal, self)
# use vertical layout
vbox = QVBoxLayout()
vbox.addWidget(self.lcd)
vbox.addWidget(self.slider)
self.setLayout(vbox)
# connects the slider to the lcd number in change_value()
# and also allows access to the slider value as it changes
self.connect(self.slider, SIGNAL('valueChanged(int)'),
self.change_value)
def change_value(self, event):
"""show the changing slider value in the LCD display"""
val = self.slider.value()
print(val, type(val)) # test
# display value in the LCD widget
self.lcd.display(val)
app = QApplication([])
mf = MyForm()
mf.show()
app.exec_()
Might have been incomplete uninstall.
Shows how to encode binary file, like sound file, to base64 encoded printable string, save the string to text file. Read the text file back in, decode to binary and optionally test play the sound (needs Windows).
# read Windows wave sound file
# save it as base64 encoded string
# to test it, read the string back, decode it and play it
# modified to work with Python 2.5.4 and Python 3.1.1
import base64
import winsound as ws
import time
# pick wave sound file you have in working directory
# or give full path, like this typical Windows XP soundfile
sound_file = "C:/Windows/Media/ding.wav"
# use mode = "rb" to read the binary file
fin = open(sound_file, "rb")
binary_data = fin.read()
fin.close()
# encode binary to base64 string (printable)
b64_data = base64.b64encode(binary_data)
b64_fname = "b64_testwave.txt"
# save base64 string to given text file
fout = open(b64_fname, "w")
try:
# Python2
fout.write(b64_data)
except TypeError:
# Python3
# convert byte string to string first
b64_data = b64_data.decode("utf8")
fout.write(b64_data)
fout.close
# read base64 string back in
fin = open(b64_fname, "r")
b64_str = fin.read()
fin.close()
# decode base64 string to original binary sound object
try:
# Python2
wave_data = base64.b64decode(b64_str)
except TypeError:
# Python3
# convert string to byte string first
b64_str = b64_str.encode("utf8")
wave_data = base64.b64decode(b64_str)
# on Windows machine you can test play
flag = ws.SND_MEMORY
ws.PlaySound(wave_data, flag)
# wait 2 seconds for sound to finish
time.sleep(2)
Here is example code:
import base64
# pick sound file you have in working directory
# or give full path
sound_file = "original.mp3"
# use mode = "rb" to read binary file
fin = open(sound_file, "rb")
binary_data = fin.read()
fin.close()
# encode binary to base64 string (printable)
b64_data = base64.b64encode(binary_data)
b64_fname = "original_b64.txt"
# save base64 string to given text file
fout = open(b64_fname, "w")
fout.write(b64_data)
fout.close
# read base64 string back in
fin = open(b64_fname, "r")
b64_str = fin.read()
fin.close()
# decode base64 string to original binary sound object
mp3_data = base64.b64decode(b64_str)
Simply store the reference to the function in the variable. Here is example:
def one():
print("hello from function one")
def two():
print("hello from function two")
def three():
print("hello from function three")
# stores the ref of function in variable
f1 = one
f2 = two
f3 = three
func_list = [f1, f2, f3]
for f in func_list:
# show the function reference
print(f)
# call the function
f()
"""my display -->
<function one at 0x01DFE150>
hello from function one
<function two at 0x01DFE198>
hello from function two
<function three at 0x01DFE108>
hello from function three
"""
... when you know that the Tea Party is nothing new.
I just love "Frazier", particularly Eddie the dog, Daphne Moon and Niles.
If variables inside functions wouldn't be local, any code would be just loaded with hard to trace bugs!
Wow, I can't barely wait till
Python Coding Help Pt 3
cames around!
range(n+1) by default goes from zero to n in steps of one
Let's say you have one real nice 2010 picture calendar, and want to use a Python program to calculate in which future years you can reuse this calendar.
Once you are done with your nice 2010 picture calendar, don't throw it away!
It can be reused in 2021, 2027, 2038, 2049, and 2055