Heyo all again!
I was wondering how to get python to detect a change in value? Basically I have a loop where its looking at data from somewhere and assigning it to a. I want python to be able to see if a changes and tell me (e.g.print 'ooo it changed'). Ive been looking around, and searched these forums, but couldn't find anything. Its probably very simple but my head's not working today.
Thanks!
Mel
User Profile
Collapse
-
Detecting change in value
-
Ah brilliant!
Thanks Bvdet! -
Right I've had some time to look at these codes.
I think I understand the code, but cannot work out how to assign the list names so I can recall them later. I tried using some of bvdet code but ended up applying a line as a list:
...Code:data = open("C:\Documents and Settings\Mel\Desktop\Python2\Blender\cameratrack.txt").read().split("\n") result = [ eval(i.replace("(",",").replace(")",""))Leave a comment:
-
I couldnt help with your other questions but I thought I might try to help with this.
I wasnt entirely sure what you meant but thought this website might help:
http://www.onlamp.com/pub/a/python/2005/12/15/profiling.html
or the page from the python library site:
http://docs.python.org/lib/profile.html
sorry if I completely misunderstood what you wanted!Leave a comment:
-
Thanks for all the input guys!
I will have to have a proper look at the codes (i dont fully understand some of them on first glance) but will pop back if I have any queries!
Thanks again!
MelLeave a comment:
-
Ah I see, that makes it neater. Will incorporate that into my code. Thanks barton!Leave a comment:
-
Reading from file to multiple lists
Hello again all! (and happy easter if you are that way inclined)
I have this file called cameratrack.txt :
And basically it is frame numbers...Code:0 (0 ,0 ,0 ) 5 (5 ,0 ,0 ) 10 (10 ,0 ,0 ) 15 (15 ,5 ,0 ) 20 (20 ,10 ,0 ) 25 (25 ,15 ,0 ) 30 (30 ,20 ,5 ) 35 (30 ,25 ,10 ) 40 (30 ,30 ,15 ) 45 (30 ,30 ,20 ) 50 (30 ,30 ,25 )
-
When I searched Google for Python Forum TheScripts came up 11th - you've lost one place :O
Im not sure clicking on the link improves its position though. Isnt it more to do with if your page meets certain standards etc? I could be wrong, I don't really know how search engines work :S
Edit - on that note this was quite an interesting read:
http://www.thesitewizard.com/archive/google.shtml...Leave a comment:
-
Thank you all very much for your help!
I wasn't floating both numbers, only the ones that were being read in from the file which is why it wasnt working. So again many thanks for the help!
Barton: Good to be back! I've been working on using Blender quite a lot, and whilst it's a very nice piece of software isnt exactly the easiest thing to use with python!
MelLeave a comment:
-
Change from an integer to a decimal
Heyo all,
Having a problem which seems really stupid but I just cant solve it.
Im reading in a number of integers from a file e.g. 179, 23, 56
I then have to divde them by 255, but when I do I only ever get values of 0 or 1 rather than something like 0.56, 0.79. I thought I could just convert the number to a float before dividing it e.g a = 179 therefore float(a), but that doesnt seem to work, and Ive looked about... -
Aw no worries!
If people are interested in 3D graphics Blender is a great free program! Also if you like playing about with python there's a lot of stuff you can do with it.Leave a comment:
-
Python with Blender
Firstly, this forum has grown a lot since I was last here! Which is good :)
I have a query about scripting in the program Blender, but thought I should ask if anyone has experience with Blender first? I went on the Blender forums to ask, but they weren't very helpful, and in fact looking at other posts some of them are just plain rude!
Thanks!
Mel -
Heehee I love this! Very Christmassy.
Can't say I understand all the code, but I'm going to have a go at trying to understand it!
Hope you all had a lovely christmas(or other holiday you may have), and are enjoying the rest of the holidays.Leave a comment:
-
I don't generally work on christmas(in fact I never), but whilst waiting for the cheesy xmas tv I had a burst of enlightenment as to why the code wasn't working. Simply, the answer was there are 2 canvases and it was the wrong canvas being told to change.
I now have 2 versions, the first where the new buttons are in the existing frame which looks messy, and the second where their on their own canvas and it looks tidier
...Leave a comment:
-
Thanks for the quick reply Barton!
The code doesn't seem to work on my system I'm afraid. When I click on the 'change colour' button I just get printed:
change color of item #1
''
Also you said 'This is how it is done in the docs'. Not wanting to sound dim but what docs do you mean?
I'll have a tinker with the code to see if I can get something from it!
MelLeave a comment:
-
Changing Colour with a Button
Hello!
I'm new to the Python language(about 2 months). Having done C programming for 2 years I find out I need Python for a final project, and have been trying to do get my head around object oriented programming. At the moment I'm simply trying to get the colour of a circle to change when you press a button. I've got this so far:
...Code:from Tkinter import * class Op: def __init__(self, -
I'm on Windows XP
Use Python Version 2.4 (enthon python)
Aswell as:
Vtk 5.0
Tkinter3000
I edit with EclipseLeave a comment:
No activity results to display
Show More
Leave a comment: