Anyone know a module that does CRC16 for Python? I have an aplication
that I need to run it, and am not having alot of sucess. I have a
program in C that uses a CRC16 according to CCITT standards, but need
to get a program that tests it with python as well. Thanks!
--
http://mail.python.org/mailm
I should probably have mentioned that my code is just 6 bytes long, we
send an 8 byte data packet with 2 bytes CRC. There's a CRC poly of
0x1021. Still having a bit of problems, but it's coming, thanks for the
help!
--
http://mail.python.org/mailman/listinfo/python-list
What exactly does the ^ operator do? I've seen, for example, that
3^4=7, 3^5=8. but 3^3=0. Is it just adding them together if they are
not equal, and if they are equal, outputs 0, or what? Thanks!
--
http://mail.python.org/mailman/listinfo/python-list
Thanks alot! That sure makes lots of sense!
--
http://mail.python.org/mailman/listinfo/python-list
Is there a function that will take a char. and return the ascii value?
Thanks!
--
http://mail.python.org/mailman/listinfo/python-list
Thanks alot!
--
http://mail.python.org/mailman/listinfo/python-list
I am looking for a good tutorial on how to extend python with C code. I
have an application built in C that I need to be able to use in Python.
I have searched through various sources, starting of course with the
Python site itself, and others, but I felt a bit lacking from the
Python site, it seem
Perhaps it would be nice if they could include in the python documents
a link to download a sample code, the one that they were building in
the whole program, or at least a page that puts it all together? I get
a much better idea of how thing work when they are all put together
personally, and then
I am writing a program that mimics a program written in C, but using
Python-supiorior techniques. The C program calles a library function,
non-open source, I only know that it sends it a command
LINUX_CAN_Open() as for a few others as well. Is there a way I can call
this function from Python withou
How exactly do you do that? Just to get some kind of an idea, perhaps
you could share bits of code? Thanks!
--
http://mail.python.org/mailman/listinfo/python-list
The trick is via something called Extending. Pyrex just makes extending
a bit easier, but, depending on the complexity of the function, it
might be easier just to extend it yourself. Basically you make a
function that translates python into C. There are some instructions on
the Python website, http
I am currently writing an extention module that needs to recieve a list
of characters that might vary in size from 0 to 8. This is written as a
list of characters rather than a string because it's easier to
manipulate. However, when I pass this list of characters into the
extention module, it keeps
I am in the process of writing an extention module, and am coming up
with lots of problems. Perhaps someone could be of use. I keep getting
data that isn't what I'm sending the program. Let me give the line of C
code and Python Code and output to illistrate the problem.
write_can(can_han,0x0140,'a
I tried Ctypes, but it was giving me tons of problems in the install
phase, and so I decided it'd just be better to use an extention module.
It's the type of stuff that could be perfectly done with ctypes, but...
Oh well. Also, I've done all but this last little piece with
extentions, might as well
Forgot, var declartions
int can_han;
int com;
char len;
char dat[8];
--
http://mail.python.org/mailman/listinfo/python-list
Well, the point of declaring it as a char was to have it as an 8 bit
integer, as is requested later on in the program. Anyways, I tried
making the changes, similar results. The len value was always right,
the problem seems to be in this com value. BTW, it doesn't give me one
single warning, so I do
Thanks for the help, I actually ended up writing my own simple
charlist2string function, I realized it was only about 4 lines of code,
but, appreciate the help!
--
http://mail.python.org/mailman/listinfo/python-list
Never mind, problem solved. The other problem I was having was I forgot
to put the .so at the end of a file, so it didn't change anything.
Thanks for all of the help!
--
http://mail.python.org/mailman/listinfo/python-list
I have been writing a program that is designed to return an 8 byte
string from C to Python. Occasionally one or more of these bytes will
be null, but the size of it will always be known. How can I write an
extention module that will return the correct bytes, and not just until
the null? I would thi
Thanks for the help!
--
http://mail.python.org/mailman/listinfo/python-list
I am building a GUI interface at the moment, and would like to have
support for displaying a jpg file, and a FITS file if possible. Is
there any way to do this? My interface has been written in Tkinter at
the moment, especially because of it's great portability, I wouldn't
have to install the other
I'm tyring to set the size of the window that is opened when you open a
Tkinter window, without much sucess. I have tried changing the heigth
and width atributes, but it doesn't do anything. I tried using the
grid_propagate command that I saw to use, but made the window even
smaller... What can I d
Okay. I have alot of items that are put on the basic frame already,
using a grid method. Will this change anything?
--
http://mail.python.org/mailman/listinfo/python-list
I am trying to write a thread that will execute a function every 2
seconds until the program is close, in which case it will stop. I can
write the program easy enough to execute the command every 2 seconds,
the problem comes when I try to close the program. It won't close the
thread. Any ideas as t
That helps alot with the Daemon and recipe! Thanks for the help!
--
http://mail.python.org/mailman/listinfo/python-list
Is there a way to stop a thread with some command like t.stop()? Or any
other neat way to get around it? Thanks!
--
http://mail.python.org/mailman/listinfo/python-list
Thanks!
--
http://mail.python.org/mailman/listinfo/python-list
I want to have a checkbutton that when it is pushed will do a function
depending on if it was pushed before or not. Ei:
b=checkbutton(command=check)
b.grid(row=0,column=0)
def check():
if (b.value==0):
do_stuff_here()
elif(b.value==1)
do_other_stuff_here()
However,
Ere, ignore the mis-capped Checkbutton and the missed master call in
it...
--
http://mail.python.org/mailman/listinfo/python-list
Is there a way to make a new window pop up using Tkinter? I have some
functions that require more data in my interface than I have space for,
and would like to be able to pop up a new window to request this
information. Thanks!
--
http://mail.python.org/mailman/listinfo/python-list
Okay, never mind about my first question, I got that answer by using
Toplevel. However, there' s still a question to be answered.
I popped up this new window with the intent to have something like
this:
"what is your question"
Ei, there's a question popped up, a label that
That solved the problem. Thanks!
--
http://mail.python.org/mailman/listinfo/python-list
I've been trying to build a fairly simple message box in tkinter, that
when a button is pushed, will pop up a box, that has a line of text, an
entry widget, and a button, that when the button is pushed, will return
the value in the line of text. However, while I can read the value of
the button, I
Do you have any info on dialogs? I've been trying to find some, without
alot of success...
--
http://mail.python.org/mailman/listinfo/python-list
Thanks alot, that helped TONS! Just had to modify it slightly, but,
well, it works great now. Thanks!
--
http://mail.python.org/mailman/listinfo/python-list
Is there a way to put an image loaded from PIL into a TKinter GUI?
Without converting the image to a .bmp, and using a canvas? If that's
the only way it'll work, I'll take it, but... It would be nice
otherwise...
--
http://mail.python.org/mailman/listinfo/python-list
That would be extremely useful.Thanks!
--
http://mail.python.org/mailman/listinfo/python-list
I would like to limit a floating variable to 4 signifigant digits, when
running thorugh a str command. Ei,
x=.13241414515
y=str(x)+" something here"
But somehow limiting that to 4 sign. digits. I know that if you use the
print statement, you can do something like %.4d, but how can I do this
with
Yep, I was thinking in C, not python. Thanks for the help!
--
http://mail.python.org/mailman/listinfo/python-list
Wait, one more question. If the number is something like:
1.32042
It is like
"1.32 stuff"
I would like it's size to remain constant. Any way around this?
--
http://mail.python.org/mailman/listinfo/python-list
I've been thinking about writing a program to generate the world's
largest prime numbers, just for the fun of it. This would require being
able to hold an 800 digit number into memory (25 megabits, or a
little over 3 megs of memory for just one variable...) I would also
need several smaller var
Okay, so I've been getting this error message when trying to use PIL to
open a JPEG, that there isn't a library by the name of libtiff.so.3 .
I've been searching the documentation, there isn't any reference to
this library. Also, I don't know why it's doing this as I'm trying to
open a JPEG, and no
Well, as I'll be doing lots of multiplication, guess that GMPY is the
way to go. I'll use DecInt only for converting to strings if I find
anything interesting. This is all just kind of a theoretical aproach,
but, it can be lots of fun. Who knows if Python'll help find the
largest prime number ever?
I got it from the PIL website, version 1.1.5. I guess it's possible
that there's another library Image on the computer that it could be
confusing? I'm looking for new things. Thanks!
--
http://mail.python.org/mailman/listinfo/python-list
Oddly enough, that seems to have solved the problem. Duh. Take the
simple solution first. Thanks for the wake up call!
--
http://mail.python.org/mailman/listinfo/python-list
Well, it seems to have resolved the problem. Don't know what was
causing it to begin with, but I'll take it...
--
http://mail.python.org/mailman/listinfo/python-list
I've been trying to use a canvas to display different pictures on a
Tkinter interface. However, it doesn't seem to update the information.
Ei, I have something like this.
canvas=Canvas(master,blah...)
canvas.pack()
def change_pic(path):
global pic
image=Image() #I'm using PIL to
Update: I can put the image in, but it spits out errors, adding this to
it:
canvas.insert(pic)
BTW, I noted that my code was written incorectly The function should be
as follows:
def change_pic(path):
global pic
image=Image() #I'm using PIL to use the images, but I
don't think
I am trying to write a function that holds a variable-length quene. The
quene has 2 bits of information. At some point, I would like to remove
bits of this quene, when they are completed. Is there a way to do this
with something as follows?
quene=[]
quene.append((4,2))
quene.append((3,6))
if(4 in
Thanks for the suggestions, I've put them on the page already. I used
.zips so as not to confuse anyone that it's some kind of a file, but, I
have used the formentioned sourcecode 2 HTML colorizer to put up nice
web previews, as well as commenting the code a bit more. Thanks for
your help!
--
htt
I have a program that I am devoloping, that uses python as a GUI
interface for a camera that we am building. Our camera is controlled
using an 8 byte control squence, depending on the command, will have
several configurations for each byte. I need to be able to have some
way to manage all 8 bytes w
As a bit more of an update, I have decided to create a list of strings,
but am having a problem. To illistrate this in a simple manner.
B='\x12','\x32'
B[0]='\x12'
I cannot get this to work, and I need to get it to work somehow. How
can I make it happen? Is there a function that I should use, a s
Thank you very much! That managed to fix the problem!
--
http://mail.python.org/mailman/listinfo/python-list
I need a function that will tell if a given variable is a character or
a number. Is there a way to do this? Thanks!
--
http://mail.python.org/mailman/listinfo/python-list
LOL. As to me being a newbie to programming, well, I've been
programming to some extent for the last 10 years, although never
professionally. The first few questions were enough to help me solve
the problem that I had. And I've been programming Python for 4 months
or so, but it's been pretty intens
I don't know if I can help with this much, I'm still somewhat new to
python, but it is my understanding that "simple" variable, ei, strings,
ints, etc, although they don't have such names, behave like variables,
ei, if you pass them to a function, the function will copy them into a
new spot. Howeve
Let's say I make a program something like follows:
x=[]
x.append([1,2,3])
x.append([4,5,6])
print x
print x[0]
print x[0][1]
x[0][1]=5
Okay, everything works here as expected except the last line. Why won't
this work? Thanks for the help!
--
http://mail.python.org/mailman/listinfo/python-list
Never mind, I just realized that my code was actually a list inside of
a tuple, and not a tuple inside of a tuple, thus giving the confusion
that it had. Thanks for the help!
--
http://mail.python.org/mailman/listinfo/python-list
I am building a GUI interface with Tkinter. I need to have a way to
open and save files. Is there a nice GUI that can do that for me, ei,
show what files are avaliable, a choose file type function? If it
matters any, I am planning on running this on both windows and linux.
Thanks for the help!
--
Thanks for the help!
--
http://mail.python.org/mailman/listinfo/python-list
I'm trying to display a picture on a Tkinter Canvas. It seems to work
fine the first time that it is displayed. However, subsequent times
running shows an error like this:
TCLerror: Wrong # args: should be ".-1211472948 .-1211470996 addtag tag
searchCommand ?arg arg ...?
My code works like this:
I have an image that is in a "raw" format, ei, no place markers to tell
the dimensions, just a big group of numbers. I happen to know the
dimension of this array from a different source. I would like to be
able to display it. Is there a way to do this easily? I know that
several libraries use a "ra
That will definatly help. Thanks!
--
http://mail.python.org/mailman/listinfo/python-list
Well, the numbers are in a string of variable length. My camera can
read specific parts of it's display, so an image of 1024x1024 is just
as likely to happen as one of 16x342. Well, not really, but they both
could happen. The data is passed by giving the dimentions via a
seperate protocol, and then
It's funny, I can put in more variables than needed, it doesn't even
call the function, and yet, magically, the picture appears. Odd... Just
wish I could solve the problem...
--
http://mail.python.org/mailman/listinfo/python-list
Well, it's a custum-built camera, so it's not standard by any means.
That being the case, I know it's exact format, which is as follows. It
is a stream of 16 bit numbers, each representing a point on a grid. The
grid is define in a seporate way, outside of the format, but is given a
number of rows
That did the trick, I can now remove the bad tag statement, and it all
works just nicely. Thank you very much!
--
http://mail.python.org/mailman/listinfo/python-list
I am seeking a way to resize a PIL image, even if the original is a
smaller dimention than the new size. Resizing seems to only make an
image smaller, and not larger. I have a 700x700 sized picture,
sometimes that will display an image larger and other times smaller. Is
there an easy way to do this
I am building a TK interface, that has several threads. If all threads
are running actively, including the main one, the interface doesn't
update. For example, I have something like this, although more complex
import time, threading
master=Tk()
def thread:
global x
x=0
while(TRUE):
x=x
I used thumbnail originally, and am using resize now. Perhaps it has to
do with the image type (That is based on strings), but the resize
function just didn't do it for me. No idea why... Oh well, probably
just a problem for me, but, I've found a way around it, for the time
being.
--
http://mail.
Any way you could provide a fairly simple example, or a website that
shows it? I understand that I must create a thread for mainloop,
however, I can't see how to make that work, every time I do, it ends
the program only a few seconds late. Will I have to make an even for
all buttons, etc that are o
I am building a tkinter program. A part of this program is to read data
from an incoming interface, and depending on the data, will display a
bit of text on the tk dialog, it decodes this data, so to speak. If one
command is sent, everything's just fine. When multiple are sent, the
program will sto
Nope, that's the oddest thing about it all... Perhaps the statement is
called twice or something along those lines, but there again, I can't
see how it would be...
--
http://mail.python.org/mailman/listinfo/python-list
Only 1 process initiated Tkinter.Tk. I guess this'll just be a tough
bug hunt... It drives me nuts that it should work, it just doesn't for
some reason... I guess I can try various things to make it work, but,
well, I would rather that it just works to start out with...
--
http://mail.python.org/
I thought I mentioned that I'm running in linux, and yes, there are
threads involved. I just don't know why on one machine that it would
run so differently than another.
As to re-writing my whole code, well, I've got around 2500 lines of
code, and while re-writing would be faster I'm sure, I still
I have a function in a program that works something like this.
def load_pic_data(width,heigth,inpdat, filt=TRUE):
data=''
total=0
tnum=0
size=100
for y in range(0,heigth):
row=''
for x in range(0,width):
Hmm. The problem is that the required form for the image is as a string
of characters to convert with the tkimage interface, at least, as I
understood it. Perhaps an array would work, I'll try that when I get
ahold of the computer in question (One thing required is a linux only
library, and I don't
Oh, I should also mention, I used a memory monitor and saw the amount
of memory being used go up with time, even when the function ended,
meaning I did the 10 128x128 pictures, never was any memory dealocated
until I exited the program.
--
http://mail.python.org/mailman/listinfo/python-list
FYI, to all who asked, I was indeed just simply monitering the system
memory. I changed my approach to one that uses arrays and simply joins
the statements together at the end, it seems to have improved the
speed. However, for some reason it still takes a small eternity to
process on one computer,
Very interesting results with the last test. I guess I go back to my
other code then, even if it is only a hair faster, it's still faster...
It's odd, I just ran another test. There's 2 ways I can call my
load_pic function, first of all, through taking a picture, secondly by
loading a picture. Fo
Fredrik Lundh wrote:
> Giovanni Bajo wrote:
>
> > --- foo.py -
> > def iters(n):
> > s = ''
> > for i in xrange(n):
> > s += chr(i%64)
> > return s
> >
> > def iters2(n):
> > L = []
> > for i in xrange(n):
> > L.append(chr(i%64))
> > return "".join(L
The times that I posted was the time that it took to perform ONE row
iteration. As you can see, the time was going up, fairly dramatically.
Why on earth could it be doing this? I understand the the time will
fluctuate somewhat depending upon what else the CPU is doing, but, why
is the base time inc
I have made one confirmation. The only identifiable difference that I
have seen is that one runs on python 2.4.2, and the other 2.4.1. Oddly
enough, it's the first one that's the one that is having more problems
than the second... Why that is, I don't know. It still could be
something else, but...
The reason it's done in width and heigth is that there is some other
non-related processing functions that were going on in the mean time
with the problem. I found the source of the slow-down, when 2
non-important lines of code were commented out, the program worked
perfectly.
I am trying to find a nice function that quickly determines the
determanant in python. Anyone have any recommendations? I've heard
about numpy, but I can't get it to work (It doesn't seem to like the
import Matrix statement...). Thanks!
--
http://mail.python.org/mailman/listinfo/python-list
I am using Windows, using Python 2.4. Perhaps I just did the import
statement wrong? I've never installed a library in Windows before,
perhaps I did something wrong there too.. But anyways, it just doesn't
seem to work. The import statements were:
import Matrix, LinearAlgebra
Neither seem to work
Never mind, I realized I was using a bit of code way too old. I just
needed to change the import statements to:
import numpy.matrix
import numpy.linalg
Thanks for the help!
--
http://mail.python.org/mailman/listinfo/python-list
I have a program running several threads. One of them must be done
every (Specified time, usually 1 second). The whole point to having a
thread is do this. However, I've noticed the following. When there is
another part of the program that is active, this thread slips into
disuse, ei, it's only ran
The stuff that it runs aren't heavily processor intensive, but rather
consistant. It's looking to read incoming data. For some reason when it
does this, it won't execute other threads until it's done. Hmmm.
Perhaps I'll just have to work on a custom read function that doesn't
depend so much on proc
The read function used actually is from a library in C, for use over a
CAN interface. The same library appears to work perfectly find over C.
I wrote an extention module for it. The function t_config is the
threaded function that will call a function called config once per
second. Note the time.tim
Adding that bit of code seems to have fixed the problem, thanks alot!
--
http://mail.python.org/mailman/listinfo/python-list
I have a picture that is being displayed on a canvas interface, that I
want to do the following. When a mouse button is clicked on the canvas,
I want to pass to a function the X and Y coordinates of where this
mouse button was pushed. Futhermore, and I don't know if this is
possible, I would like t
I guess I should have mentioned that the canvas is a Tkinter canvas,
but, well, I guess that could be infered.
--
http://mail.python.org/mailman/listinfo/python-list
Ahh, exactly what I was looking for. Thanks for the help!
Fredrik Lundh wrote:
> Tuvas wrote:
>
> > I have a picture that is being displayed on a canvas interface, that I
> > want to do the following. When a mouse button is clicked on the canvas,
> > I want to pass t
I am trying to execute a function with a tkinter event binding double
click. With 2 mouse clicks done quickly, the function should happen,
otherwise, it should not. However, I am noticing that the time that the
event binding of a double-click is quite long, on the order of a second
or so. I am doub
I know this is probably a very simple question, but I am building a
program that is now at about 2400 lines of code in the main module. I
need to break it up, however, there are certain variables that I would
like to use among all of them, namely the TKinter background. It's
build using tkinter, so
Could I just do this then?
from foo import x?
One more question now that I've tried this. In my main function, I have
alot of init code. I don't want this code to be re-ran when the second
module imports the first. Is there any way around this? Thanks!
--
http://mail.python.org/mailman/listinfo
Most of these are indeed independed of Tkinter, except for a status
report message that is often sent in response. I' have a few small
files already that do this, however, I would ike to be able to put
several that do in fact need to post status messages as well. There are
about 2400 lines of code
Ahhh. Actually, I realized my problem was the fact that not everything
had been loaded yet. Circular loading can be a bit difficult I can
see... I guess I need to import the new module after x has been
declared? Ei, I need this.
Mod1.py
x=1
from mod2.py import *
=
Mod2.py
from mod1
I have made and recently posted a libary I made to do Modular
Arithmetic and Prime numbers on my website at
http://www.geocities.com/brp13/Python/index.html . I am currently in a
crypotology class, and am working on building a RSA public key
cryptology system for a class project. I am building the
1 - 100 of 130 matches
Mail list logo