0

thank you very much it worked.

just one more thing. now that this works i tried a simple programm

[CODE]import risar
from turtle import Turtle

t = Turtle()

def square(turtle, l):
for i in range(4):
turtle.forward(l)
turtle.left(90)

for i in range(5):
square(t, 150)
t.turn(72)[/CODE]

and now it says that
Turtle object has no attribute 'Turn'

0

i have this 2 custome modules and when i try to call module turtle i get an error message and i dont know what it means or better said i dont know where seems to be a problem. i think it should work just fine

this is the message i get:
AttrubuteError:'module' object has no attribute 'krog_s'

module codes:

risar:

[CODE]from PyQt4.QtCore import
from PyQt4.QtGui import

app=QApplication([])
widget = QDialog()
widget.setWindowTitle("Janezovo zasilno platno")
widget.setLayout(QVBoxLayout())
widget.layout().setMargin(2)
widget.scene = QGraphicsScene(widget)
widget.scene.setBackgroundBrush(Qt.black)
widget.view = QGraphicsView(widget.scene, widget)
widget.view.setAlignment(Qt.AlignLeft | Qt.AlignTop)
widget.view.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)
widget.view.setRenderHints(QPainter.Antialiasing | QPainter.SmoothPixmapTransform)
widget.layout().addWidget(widget.view)
widget.resize(800, 500)
widget.scene.setSceneRect(0, 0, widget.view.width(), widget.view.height())
widget.view.setSceneRect(0, 0, widget.view.width(), widget.view.height())
widget.show()
widget.raise_()
maxX = widget.view.width()
maxY = widget.view.height()

bela, crna, rdeca, zelena, modra, vijolicna, rumena, siva, rjava = barve = Qt.white, Qt.black, Qt.red, Qt.green, Qt.blue, Qt.magenta, Qt.yellow, Qt.gray, Qt.darkRed

barva = QColor

def obnovi():
widget.scene.update()
qApp.processEvents()

def cakajTipko():
import msvcrt
obnovi()
msvcrt.getch()

def cakaj(t):
import time
obnovi()
time.sleep(t)

def barvaOzadja(color):
widget.scene.setBackgroundBrush(color)

def crta(x0, y0, x1, y1, color=bela, width=1):
crta = widget.scene.addLine(0, 0, x1-x0, y1-y0, QPen(QBrush(color), width))
crta.setPos(x0, y0)
return crta

def tocka(x, y, color=bela):
return widget.scene.addLine(x, y, x, y, QPen(QBrush(color), 1))

def elipsa(x, y, rx, ry, color=bela, width=1):
elipsa = widget.scene.addEllipse(0, 0, rx, ry, QPen(QBrush(color), width))
elipsa.setPos(x, y)
return elipsa

def krog(x, y, r, color=bela, width=1):
return elipsa(x, y, r, r, color, width)

def krog_s(x, y, r, color=bela, width=1):
elipsa = widget.scene.addEllipse(-r, -r, 2r, 2r, QPen(QBrush(color), width))
elipsa.setPos(x, y)
return elipsa

def besedilo(x, y, txt, color=bela, size=20, font="Arial"):
font = QFont(font)
font.setPixelSize(size)
txt = widget.scene.addText(txt, font) ...

0

hello!
i have this problem with this code. I mean everything works just fine except i dont know how to change program to return me new value. in my program i had to make 2 functions. preberiKontakte() to get their names & id and izlusciOsebe(vrstica, kontakti) to get set of people on the picture.
and then i have to write down the programm to get dictionary of people that know each other depending on the pictures they were on together.

for example this is what my program does:

{'Ahmed': set(['Osama', 'Fadil', 'Mustafa', 'Jibril']), 'Mustafa': set(['Osama', 'Ahmed', 'Fadil', 'Omar', 'Jibril']), 'Abdulah ibn Husein': set(['Osama', 'Husein']), 'Abdul': set(['Osama']), 'Husein': set(['Abdulah ibn Husein']), 'Osama': set(['Ahmed', 'Mustafa', 'Abdulah ibn Husein', 'Abdul']), 'Fadil': set(['Ahmed', 'Mustafa', 'Omar', 'Jibril']), 'Omar': set(['Fadil', 'Mustafa']), 'Jibril': set(['Ahmed', 'Fadil', 'Mustafa'])}
that means that

now i would have to edit my program to get all the pairs of people that ever apeared on the picture together
so instead that i would get what i have above, i should get:

Osama Abdul
Abdul Osama
Osama Abdulah ibn Husein
Abdulah ibn Husein Osama
Osama Ahmed
Osama Mustafa
Ahmed Osama
Ahmed Mustafa
Mustafa Osama
Mustafa Ahmed
Abdulah ibn Husein Husein
Husein Abdulah ibn Husein
Ahmed Mustafa
Ahmed Jibril
and so on..
this shouldnt be too hard but i have already spend too much time on this and i have to move on with studying><
here are also some files if anyone would like to help me><
[url]http://www.mediafire.com/file/8zrwyjdg8fyvad2/podatki-picasa2.zip[/url]
[CODE]
def preberiKontakte():
d = {}
for l ...

0

Hello there.

I'm new in python thats why i hope for one quick explanation.

I'm making this program just for fun tho i dunno how to really use raw_input in loop.

[CODE]from random import *
ime_f = raw_input("Vnesi ime fanta: ");
priimek_f = raw_input("Vnesi priimek fanta: ");
ime_z = raw_input("Vnesi ime deklice: ");
priimek_z = raw_input("Vnesi priimek deklice: ");
x = randint(0, 70);

if ime_f == "Lojze" & priimek_f == "Slak" & ime_z == "Mihela" & priimek_z == "Cas":
print "Ujemanje je 100%";
else:
print x; [/CODE]

the thing is that i dont know the syntax so that the 8th line would work. What should i do so that if i enter the right words that the condition would be fulfilled?

0

i've forgot to change all the names before reposting it here.

[CODE]artist = ImageDraw.Draw(picture)[/CODE]

now with this error resolved the program should make a picture with 100 diffret lines. well it doesnt open it to me and i would like to know why? Or is it still problem in the code that i do not get the right result (picture with 100 diffrent lines)

0

[CODE]from PIL import Image, ImageDraw
from random import randint
picture = Image.new("RGB", (600, 600))
artist = ImageDraw.Draw(picture)

for i in range(100):
x1, y1 = randint(0, 600), randint(0, 600)
x2, y2 = randint(0,600), randint(0,600)
color = (randint(0, 255), randint(0, 255), randint(0, 255))
width = randint(2, 20)
artist.line([x1, y1, x2, y2], color, width)

picture.convert("RGB")

picture.show()[/CODE]

i've made this program just to demonstrate my problem. The thing is that when i run this program Windows Photo Viewer opens up but theres no image just this message:
[QUOTE]WPM can't open this picture because either the picture is deleted, or it's in a location that isnt available[/QUOTE]

Now i'm using python 2.7 and W7 and i would really apreciate help because i cannot program further because i cannot see the result