= GPIO()
LED01 = gpio.pin04
LED01 = 1 # led diode is shining (or gpio pin 4 is set)
LED01 = 0 # led diode is off
General suggestions, how to organise this work are more then welcome.
Petr Jakes
--
http://mail.python.org/mailman/listinfo/python-list
> >>> import Image
> >>> im=Image.new('L', (100,100))
> >>> im=im.convert('1')
> >>> px=im.load()
> >>> px[0,0]
Thanks, load() method works great.
One more question.
Finally, I would like to store array in the database.
What is the best way to store arrays?
Petr
--
http://mail.python.org/
> What file format is the graphic in? How big is it?
>
> What file format do you want it to be?
>
Now, I am able to create the png file with the resolution 432x64 using
PIL (using draw.text method for example).
I would like to get the 432x64 True/False (Black/White) lookup table
from this file,
I would like to convert simple B/W graphic to the 432x64 pixel matrix.
It is intended to display this graphic on the one color LED matrix
sign/display (432 LEDs width, 64 LEDs height).
I am experimenting with the PIL, but I did not find solution there.
It will be really helpful If somebody here ca
(0.01)
seconds = time.time()
if not int(seconds % (5)):
if eventFlag:
print "5 seconds, hurray"
eventFlag = False
else:
eventFlag = True
Best regards
Petr Jakes
--
http://mail.python.org/mailman/listinfo/python-list
ck, sys
print sys.exc_info()
traceback.print_exc()
Thanks for your replies.
Petr Jakes
--
http://mail.python.org/mailman/listinfo/python-list
ot; )
q = MyTable.select()
for row in q:
print row.album, row.filepath
for row in MyTable.select(MyTable.q.album == "Pinkk Floyd"):
print row.album, row.filepath
HTH
Petr Jakes
--
http://mail.python.org/mailman/listinfo/python-list
Finaly, after few experiments, I am using pygame.
It comunicates directly with the framebuffer and the performance is
excellent.
Thanks for your help.
Petr Jakes
--
http://mail.python.org/mailman/listinfo/python-list
ll let you put the result of a SELECT into a new
> table.
>
> John Nagle
I agree,
maybe following can help
http://tinyurl.com/32colp
Petr Jakes
--
http://mail.python.org/mailman/listinfo/python-list
t))
It works, but it does not look very nice to me.
Is there some different/nicer/more pythonic way how to achieve above
mentioned?
regards
Petr Jakes
--
http://mail.python.org/mailman/listinfo/python-list
> I agree that SDL is probably the best choice but for the sake of
> completeness, Gtk can (at least in theory - I've never tried it) be
> built against directfb and run without X.
from the Pygame Introduction: Pygame is a Python extension library
that wraps the SDL library and it's helpers. So y
> > is already solved).
>
> what you are looking for is curse :)
> http://docs.python.org/lib/module-curses.html
> http://www.ibm.com/developerworks/linux/library/l-python6.html
>
> renaud
Renaud, thanks for your reply.
I think I was not specific/clear enough in my first posting. I know
the curse
here for your opinions/experiences/advices.
Best regards
Petr Jakes
http://www.libsdl.org/
http://pyfltk.sourceforge.net/
http://www.pygame.org/news.html
http://pyui.sourceforge.net/
http://pyglet.org/
--
http://mail.python.org/mailman/listinfo/python-list
On Jan 4, 4:55 pm, [EMAIL PROTECTED] wrote:
> Petr thanks so much for your input. I'll try to learnSQL, especially
> if I'll do a lot of database work.
>
> I tried to do it John's way as en exercise and I'm happy to say I
> understand a lot more. Basically I didn't realize I could nest
> dictiona
can control Excel from Python using win32api, win32com
( http://tinyurl.com/2m3x3v )
HTH
Petr Jakes
#!/usr/bin/env python
# -*- coding: cp1250 -*-
import sqlite3
con = sqlite3.connect(":memory:")
cur = con.cursor()
normalizedInputData=[]
subCategories=[]
rawData = [['Italy
> So the data comes in as a long list. I'm dealing with some
> information on various countries with 6 pieces of information to
> pivot. Just to make it simple it's like a video store database. The
> data is like [Country, Category, Sub Category, Film Title, Director,
> Number of Copies]. data
):
for no in range(10):
yield no
myNo=property(getInfo)
gen=GenExample()
print gen.myNo.next()
print gen.myNo.next()
.
.
print gen.myNo.next()
--
Petr Jakes
--
http://mail.python.org/mailman/listinfo/python-list
tside class
definition).
The meaning of my question was:
Is it possible to define some general sort of set/get/del/doc rules
for the attributes which are defined in the code AFTER the
instantiation of an object.
I am sending this question even I feel such a "on the fly" creation of
th
et/del/doc function
calls upon access to defined attribute).
My question is: is it possible to set the "property" for any attribute
when I do not know what will be the name of the attribute in the
future?
Thanks for your reply
Petr Jakes
--
http://mail.python.org/mailman/listinfo/python-list
> Yes, I realize Excel has excellent support for pivot tables. However,
> I hate how Excel does it and, for my particular excel files, I need
> them to be formated in an automated way because I will have a number
> of them over time and I'd prefer just to have python do it in a flash
> than to do
Patrick,
in your first posting you are writing "... I'm trying to learn how to
make pivot tables from some excel sheets...". Can you be more specific
please? AFIK Excel offers very good support for pivot tables. So why
to read tabular data from the Excel sheet and than transform it to
pivot tabel
What about to let SQL to work for you.
HTH
Petr Jakes
Tested on Python 2.5.1
8<--
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sqlite3
con = sqlite3.connect(":memory:")
cur = con.cursor()
inputData=(
('Bob', 'Morn', 240),
('
n to offend somebody here and I am really grateful for all
replies.
Thank you
Petr Jakes
--
http://mail.python.org/mailman/listinfo/python-list
. Such a "reports" can be read by user using web browser later
on.
I was just trying to find if somebody here can point me to the
existing tool, which is suitable for such a task.
Anyway thank you for trying me help.
Petr Jakes
--
http://mail.python.org/mailman/listinfo/python-list
ific cells.
Googling for a while I have found only this tool:
http://pasko.net/PyHtmlTable/
Your tips to some other tools or/and your suggestion how to solve
above mentioned will be very helpful.
Thanks and regards
Petr Jakes
--
http://mail.python.org/mailman/listinfo/python-list
Thanks, it works.
And thanks for your comments which are worth to think about :)
Petr
> This has nothing to do with your previous problem. Use
>
> from __main__ import myFunction, myOtherFunction, ...
>
> or
>
> from __main__ import *
>
> if you prefer "namespace pollution paradise"*.
>
> Again, i
On Dec 22, 7:05 pm, Peter Otten <[EMAIL PROTECTED]> wrote:
> petr.jakes.tpc wrote:
While you could either alter the textfile to
>
> >>> import __main__ as displeje_pokus
>
> or the module along the lines of
>
> # not recommended!
> from displeje_pokus import TextyDispleje
> if __name__ == "__main__
s bellow).
When I run "python displeje_pokus.py" I am getting an error (see
below) which I am not able to eliminate.
thanks for your reply
Petr Jakes
==
displeje_pokus.py
==
from sqlobject import *
class TextyDispleje(SQLObject):
pass
if __
ever, the __init__()
> method only takes integers (which means I'd be forced to parse the
> string myself). Does anyone know of a way I can make it use the
> string? Thanks.
http://pleac.sourceforge.net/pleac_python/datesandtimes.html
the part "http://pleac.sourceforge.net
lyse music stream form
the PC radio card to get the signal: "first tones of Frozen were
played after Sacrifice, call to the studio" :-)
Of course, the calling can be made by PC as well, but this is the
easiest part of the task :)
Thanks for your tips and comments
Petr Jakes
PS: both, Linux
On 23 ec, 14:23, westymatt <[EMAIL PROTECTED]> wrote:
> linux primarily still a little lost in how to implementent this,
> however I understand what you are saying.
maybe you can use this:
http://tinyurl.com/2zyfmw
HTH
Petr Jakes
--
http://mail.python.org/mailman/listinfo/python-list
Maybe you can try python binding for gammu, which works great for me.
HTH
Petr Jakes
http://cihar.com/gammu/python/
--
http://mail.python.org/mailman/listinfo/python-list
Hi Dennis,
thanks for your reply.
Dennis Lee Bieber napsal:
> > def dataOnSerialPort():
> > data=s.readLine()
>
> Unless you are using a custom serial port module, that should be
> s.readline()
sorry for the typo
>
> > if data:
> > return data
> > else:
> > return
Maybe I am missing something. Expect data is comming continually to the
serial port for the period say 10min. (say form the GPS), than it stops
for 1 minute and so on over and over. I would like to log such a data
to the different gzip files.
My example was written just for the simplicity (I was tr
serial port. It looks like g.close() does not close the gz
file.
I was reading in the doc:
Calling a GzipFile object's close() method does not close fileobj,
since you might wish to append more material after the compressed
data...
so I am completely lost now...
thanks for your comments.
looks strange, I have to use str(a) syntax even I know the "a"
variable is a string.
I am trying to use ChartDirector for Python (charts for Python) and the
method "layer.addDataSet()" needs above mentioned syntax otherwise it
returns an Error.
layer.addDataSet(data, colour,
Hi
my script is working well when I am running it from the terminal
window. While I am trying to start it as a Cron job, I am getting an
Error described bellow:
My configuration: Pentium III, Python 2.4.1, Fedora Core4
Thanks for your comments.
Petr Jakes
File "/root/eric/analyza_da
Thanks a lot. It works flawlessly and I have learned few new Python
"tricks" as well.
Petr Jakes
--
http://mail.python.org/mailman/listinfo/python-list
t;debugging" purposes. Finally you
will remove it.
For example you can put:
print "starting the strt function", "mynum = ", mynum, "yournum =",
yournum
on the first row of your strt function, so you will see the code is
going through there.
Finally:
Try to thi
urnum < 101"
you should test if the input is an integer as well..
http://tinyurl.com/j468c
Other suggested here which way to go.
Good luck :)
Petr Jakes
--
http://mail.python.org/mailman/listinfo/python-list
o the
> kit ? TIAMR
You can try:
Dialog
http://invisible-island.net/dialog/
HTH
Petr Jakes
--
http://mail.python.org/mailman/listinfo/python-list
o my less elegant
> co-workers can figure out what I was trying to accomplish.
>
> Sam Schulenburg
+1
Petr Jakes
--
http://mail.python.org/mailman/listinfo/python-list
hacker1017 wrote:
> im just asking out of curiosity.
a vending machine controlled from the PC (peripherals connected using
I2C bus (SMBus) and the MDB coin change-giver and the bill acceptor
connected to the serial port).
Petr Jakes
--
http://mail.python.org/mailman/listinfo/python-list
specific answers to the above
mentioned code example.
Regards
Petr Jakes
--
http://mail.python.org/mailman/listinfo/python-list
Thanks for your comment. It is mainly English issue (I am not native
English speaker).
OK, to be more specific, I would like to run the code, when the value
of seconds in the timestamp become say "00".
The whole code will run in the infinitive loop and other actions will
be executed as well, so it
irst occur of sec==0 only!! polling
10x a second
minutes=min
print "Eureca"
time.sleep(0.1)
Regards
Petr Jakes
--
http://mail.python.org/mailman/listinfo/python-list
I think you can get the answer on
http://www.die-offenbachs.de/detlev/eric3-mailinglist.html
rather then here.
HTH
Petr Jakes
--
http://mail.python.org/mailman/listinfo/python-list
off).
Petr Jakes
--
http://mail.python.org/mailman/listinfo/python-list
/kinterbasdb-3.2_pre_20060503.win32-FB-2.0-py2.4.exe
Petr Jakes
--
http://mail.python.org/mailman/listinfo/python-list
I am using following code which I have found on
http://www.ibiblio.org/obp/py4fun/ few months ago. It works well for my
purposes. Another way is to use Curses library.
HTH
Petr Jakes
#!/usr/local/bin/python
#
# t t y L i n u x . p y
#
# getLookAhead reads lookahead chars from the keyboard
Firebird CS 1.5, Python 2.4.1,
KInterbasDB 3.2b1
Thanks for your advices.
Petr Jakes
--
http://mail.python.org/mailman/listinfo/python-list
Thank you very much, Steve.
Petr Jakes
--
http://mail.python.org/mailman/listinfo/python-list
I have got Steven's book of course (it is excellent IMHO). I was just
thinking some new approaches can be found in the tutorial.
Petr Jakes
--
http://mail.python.org/mailman/listinfo/python-list
I would like to know if anybody can point me to the site, where it is
possible to find the tutorial "Using Databases in Python" which is
mentioned by Steve Holden here: http://tinyurl.com/ectj8
Thanks
Petr Jakes
--
http://mail.python.org/mailman/listinfo/python-list
Eric3 is great IMHO.
http://www.die-offenbachs.de/detlev/eric3.html
--
http://mail.python.org/mailman/listinfo/python-list
Jarek, I am using it always like in the following example to connect to
the remote host and it works for me flawlessly.
Petr Jakes
import kinterbasdb as k
con = k.connect(
host='router.maren.cz',
database='/data/sysdat01.gdb',
user='SYS
discussion groups before
posting questions (I am not saying it is a bad idea to ask here, I am
only trying to show an simple alternative how to get an answers to your
questions to you)
HTH
Regards
Petr Jakes
--
http://mail.python.org/mailman/listinfo/python-list
red in the
dictionary with the strings.
Any other suggestions?
Thanks
Petr Jakes
--
http://mail.python.org/mailman/listinfo/python-list
Thanks Steven,
credit is mentioned to be a calculated value changed at run-time and
your "third hand" suggestion is exactly what I was looking for.
Petr Jakes
--
http://mail.python.org/mailman/listinfo/python-list
ke:
lcd={2:"Your credit= %3d" % (credit)}
While I am trying to import my_dictionary in to the main code, I am
getting:
exception unhandled NameError
name "credit" is not defined
How can I organize my code so the "credit" variable will be "visible"
in
l(0, 9600, 8, "E", stopbits=2, timeout=1)
(it was recommended to you in above mentioned posting as well)
You can find plenty of examples on http://pyserial.sourceforge.net/ in
the "Examples" paragraph. Try to study and search before you ask.
HTH
Petr Jakes
--
http://mail.python.org/mailman/listinfo/python-list
Grant and Steve,
I am wowed and amazed how supportive and helpful you (and other people
in this group as well of course) are.
Thanks.
(sorry for OT)
Petr Jakes
--
http://mail.python.org/mailman/listinfo/python-list
> I think you're getting caught by the classic and/or trap in Python,
> trying to avoid using a simple if statement.
What do you mean by "the classic and/or trap"? Can you give an example
please?
Petr Jakes
--
http://mail.python.org/mailman/listinfo/python-list
the troubles with indentation
anymore.
HTH
Petr Jakes
--
http://mail.python.org/mailman/listinfo/python-list
imple and short code first,
so you will be able to understand how to communicate with the serial
port.
HTH
Petr Jakes
--
http://mail.python.org/mailman/listinfo/python-list
put()) Does it print
out something?
Petr Jakes
--
http://mail.python.org/mailman/listinfo/python-list
Well, I think it is better to start with some simple code first.
Try to read serial port and print it out.
something like this could work:
import serial
s = serial.Serial(port=2,baudrate=38400, timeout=20)
while 1:
print s.readline()
Petr Jakes
--
http://mail.python.org/mailman/listinfo
zero_list=[0,0,0,0,0,1,2,3,4]
for x in range(len(zero_list)):
if zero_list[x]!=0: break
nonzero_list=zero_list[x:]
print nonzero_list
but some more "pythonic" solutions will be posted from other users I
guess :)
HTH
Petr Jakes
--
http://mail.python.org/mailman/listinfo/python-list
Endless stories about IDEs (try to browse through this discussion group
first). Of course it depends about users personal needs and taste. So
install them and try them (I know, it's really time consuming). I thing
there is not the other way to decide which one is the best for YOU.
Petr
like to read the file with the function names sequences
# and to create tuple which will contain the function names.
# After that I would like to call functions from the tuple:
functions=(printFoo, printFOO)
for function in functions:
function()
Thanks for your postings
Petr Jakes
--
http://ma
http://www.pspad.com/en/
Petr Jakes
--
http://mail.python.org/mailman/listinfo/python-list
ot;]
for title in range(len(titles)):
if titles[title][:6] =="Title:":
x=1
try:
while titles[title+x]!="Request : Play" and
titles[title+x]!="Request : next":
x+=1
pass
print titles[title], titles[title+x]
except IndexError: pass
HTH
Petr Jakes
PS: just wonder why are you asking the same question in two different
topics
--
http://mail.python.org/mailman/listinfo/python-list
Sorry I was not precise enough in my description.
In the file, there is of course more sections starting with the keyword
type:
I would like to only analyze sections which start with the sequence:
type:
4
Petr jakes
--
http://mail.python.org/mailman/listinfo/python-list
I have a file which contains data in the format shown in the sample
bellow.
How can I parse it to get following:
(14,trigger,guard,do_action,15)
Thanks a lot for your postings
Petr Jakes
type:
4
bgrColor:
255 255 255
fgrColor:
0 0 0
objId:
16
Num.Pts:
2
177 104
350 134
objStartId:
14
objEndId
store state/transition dependencies).
Tanks to all for your previous postings.
Petr Jakes
State machine example, for the pull/push button mentioned earlier in
this discussion thread
class FSM:
'''the "states" dictionary contains user defined "st
Sorry for the typo in my previous posting. Of course it has to be:
simple liftt/push ON/OFF button
--
http://mail.python.org/mailman/listinfo/python-list
Sorry, I can't get in. Can you please show me, how to use your approach
on the simple push/push ON/OFF button for example please?
PS: seriously it is not a homework :) and I feel it like a shame I am
asking such a simple questions :(
States: ON, OFF
Transition event: "push", "lift"
transition di
st
lost with subclass and mapping attributes etc. while trying to study
the code in the example (http://tinyurl.com/a4zkn).
All I wanted to know, if, thanks to the improvements in the Python
functionality over the years, it is possible to simplify somhow the old
code.
Otherwise I have to dig through :)
principles used in this code are still valid in the "modern"
Python and if/how it can be improved (revrited) using futures of
current version of Python.
Thanks for your comments for a "newbie" and for your patience.
Petr Jakes
--
http://mail.python.org/mailman/listinfo/python-list
To provide some feedback:
As Grant Edwards posted in this list, I was running my code inside of
IDE that replaces sys.stdin with some other. While running the program
from a shell prompt, everything goes fine.
Petr Jakes
--
http://mail.python.org/mailman/listinfo/python-list
On my box (Fedora Core4, Python 2.4.1) I am getting following error:
>>> import termios, sys
>>> fd = sys.stdin.fileno()
>>> oldSettings = termios.tcgetattr(fd)
Traceback (innermost last):
File "", line 1, in ?
error: (22, 'Invalid argument')
ifics. It is
necessary to control parity bit setting before sending each
communication byte.
Regards
Petr Jakes
--
http://mail.python.org/mailman/listinfo/python-list
Fredrik, thanks for your posting. I really appretiate your reply and
your way how you kindly answer even stupid newbie's questions on this
mailing list.
I was trying: int("0xf") but I did not have idea about the optional
"base" parameter for the int function.
Thanks a lot.
Petr
--
http://mail.py
small mistake in my previous posting, sorry
from "0xf" I need "\xf" of course
and mentioned code gives me "\0xf" of course.
Thanks for your postings
Petr Jakes
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
I am trying to convert string to the "escaped string".
example: from "0xf" I need "\0xf"
I am able to do it like:
a="0xf"
escaped_a=("\%s" % a ).decode("string_escape")
But it looks a little bit complicated in this
a one-bit. For space parity
it's always a zero-bit.
Does anybody here knows some "tricks" how to set up the mark and space
parity on the UART (using pyserial???), so I can simulate 9bit
communication? (I know it sounds silly, but I would like to try to
re-configure the UART parity before
86 matches
Mail list logo