I actually decided to write my own, the thing I needed to know was the
show option to entry. That was the key!
--
http://mail.python.org/mailman/listinfo/python-list
I want to write a GUI program (Preferably in Tkinter) that will allow
for the entering of passwords, stared out like a normal program does.
Is that possible? Thanks!
--
http://mail.python.org/mailman/listinfo/python-list
Thanks, that's exactly what I wanted!
--
http://mail.python.org/mailman/listinfo/python-list
Ere, I mean testing only symetrical keys, and symetrical messages,
nothing more realistic. Sigh. Oh well. It works, and that's the
important thing. I don't know if I'll put in support for the larger key
sizes, but, I'll leave it be for now.
--
http://mail.python.org/mailman/listinfo/python-list
Okay, I figured out the problem. The problem was that my algorythm
filed the numbers into the matrix as so:
1 2 3 4
5 6 7 8...
While it should have been
1 5 9 13
2 6 10 14
...
When this was fixed, the program works great! That's what I get for
testing only asymetrical keys... Oh well, thanks for
I've actually done the tests on this one, it's actually faster to use
the += than a list, odd as it may sound. I ran into this one a while
back. The best way to do it is to build an array from scratch, fill the
array, and then join it, but I didn't have time to do it that way...
--
http://mail.py
I will admit though, I have the same question as Paul, why do you want
a random string of numbers, letters, and symbols? But, you asked for
it, so, that'll do.
--
http://mail.python.org/mailman/listinfo/python-list
I don't know if it means anything, but the AES system that I have isn't
set up to do anything other than 128 bit encryption at the moment, nor
will it likely do so, mainly because most systems only explain how to
get the 128 encryption, and not the larger sizes. I'm sure it's fairly
easy to change,
I have just finished a new function that will do AES128 encryption,
which is the standard for private-key cryptology today. In fact, the
NSA permitted AES to be used for classified documents in the USA, the
first time a public algorithm has been given this honor (Secret and Top
Secret documents can
from os import urandom
def cstring(bytes):
ret=''
while(len(ret)'0' and c<'z':
ret=ret+c
return ret
That should do it, though I bet there might be a more efficient way. I
don't know if that's the set of characters you want to use, but... If
you want a better answer, you'd h
Thanks for the function Paul, it works alot nicer than the one I had in
my program... Now, with all of this knowledge, I'm going to be brave
and try out everything with AES. It seems to be working alright, I'll
debug this more on my own than I did with my RSA code, which turned out
to be full of bu
Wow, that would have been nice to know... Oh well, I've already got the
function, might as well use it... I'm starting to learn alot more of
the standard libraries that exist for alot of the little functions. It
seems like every project I have I build a misc.py file that contains
several small, but
Wait, I now see that there is a native base 2 log in python, so I will
just do that rather than my adhoc way. The reason for adding one is to
make sure there isn't any problems if the log is, for instance, 2.2. It
will always round up. It's better to have to try twice to make sure the
number can ha
Ahh, you are correct, that is a large bug... How about this one?
def s2num(text):
if(len(text)==1):
return ord(text)
else:
return ord(text[0])+256*s2num(text[1:])
def cran_rand(min,max):
range=int(log(abs(max-min))/log(2))+1
num=max+1
if range%8==0:
cra
Actually, there was a small bug fix that I found, and I had a teacher
who told me once that there was only 5 pseudoprimes. I realized that
large numbers of prime numbers were returning false, and discovered the
root of the problem, which was that my M-R test ended too late... But,
it works now, tha
Okay, now I get the correct number of 561 pseudoprimes, 5, so I can
assume that it is indeed working right. Whew. Thanks for the help on
that one. Now, I only wish I could change the answer to my last
homework assignment... Oh well.
--
http://mail.python.org/mailman/listinfo/python-list
Ahh, I see, I missed doing the last step in my M-R test. Hmmm. Well,
got that one fixed now, time for a new release I guess. Sigh. I do seem
to be going through them rather quickly...
--
http://mail.python.org/mailman/listinfo/python-list
Good idea about the max and min values. Yes, urandom is os.urandom.
s2num('blah') will convert the phrase blah to ascii, and treat them as
if they were a big function.
Anyone else whose still interested, I found another small bug, but it
was in the modular (Again). It won't do much, but...
I did
Bryan Olson wrote:
> Tuvas wrote:
> > Okay, I don't know if your farmiliar with the miller-rabin primality
> > test,
>
> Paul is familiar with it. When he referred to your Miller-Rabin
> test, he meant all the rounds.
>
> > but it's what's called
Although, I have to brag quickly, adding in this simple prime check
speed up the algorithm to the point that it's actually faster to find a
prime number with my program than to verify a number prime with
GP/PARI, so, I feel good.
--
http://mail.python.org/mailman/listinfo/python-list
Actually, it wasn't very nice, it returned composites instead of
primes... There was alot of little bugs, I'm glad I checked it again.
The new code once again is uploaded, the previews are on their way... I
did set up a system to check for primality up to 1000, I think any more
than that and it wil
Yep, you guessed correctly about the s2num function, I knew I should
have put a bit more.. It just converts an ascii string to a number,
however many numbers that are nessicary. I could indeed check for all
primes below a certain number, however, it still seems to run quite
fast, at least to a 400
H. Well, I don't know what else I could do, except for to write a
function that doesn't require recursion. Still, 300 digits isn't too
bad... I have also realized that if you try is_prime(3) it will return
false. I'll have to work on it... Thanks for the help!
--
http://mail.python.org/mailma
Ahh, that make sense! Thanks a ton!
--
http://mail.python.org/mailman/listinfo/python-list
I know the answer is probably really simple to this, and I feel bad to
even ask, but I can't find the answer anywhere... Let me show what
happened, then ask the question.
>>> x=[[0]*2]*2
>>> x
[[0, 0], [0, 0]]
>>> x[0][1]=1
>>> x
[[0, 1], [0, 1]]
>>>
The question now. Why is the output list [[0,
Okay, I'm working on devoloping a simple, cryptographically secure
number, from a range of numbers (As one might do for finding large
numbers, to test if they are prime). My function looks like this:
def cran_rand(min,max):
if(min>max):
x=max
max=min
min=x
range=rou
Okay, I don't know if your farmiliar with the miller-rabin primality
test, but it's what's called a probabalistic test. Meaning that trying
it out once can give fake results. For instance, if you use the number
31 to test if 561 is prime, you will see the results say that it isn't.
Mathematically,
Okay, the bug in my code has been fixed, it should work alot better
now... I thought I had tested the power function, but I appearently
wasn't even close... But now it works just fine.
I guess you are right, I will have to work on a better system to be
cryptologically secure. But, at least I have
Well, the RSA element's never going to encrypt more than a small, 1
block system except under rare occasions, the primary encryption will
be AES128. Thanks for the help though!
--
http://mail.python.org/mailman/listinfo/python-list
I have discoved that the mod function isn't quite right in dealing with
powers, but, I'll have it fixed shortly.
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
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
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
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
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 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
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
Adding that bit of code seems to have fixed the problem, thanks alot!
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
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 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
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
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 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 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
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
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
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,
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
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
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):
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
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/
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
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
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 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.
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 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
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
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
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, 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
That will definatly help. Thanks!
--
http://mail.python.org/mailman/listinfo/python-list
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
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:
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!
--
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
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
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
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 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
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 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
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'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
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
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
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
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?
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
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
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
Yep, I was thinking in C, not python. Thanks for the help!
--
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
That would be extremely useful.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
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
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
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
That solved the problem. 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
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
Ere, ignore the mis-capped Checkbutton and the missed master call in
it...
--
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,
1 - 100 of 130 matches
Mail list logo