I am attaching the image of the symbol please help... its urgent....please reply
This is the url of wher u can see the symbol... its an assignment....
[url="http://www.yogaelements.com/blog/wp-content/uploads/2008/02/om4.jpg"]
Need not be exact copy
i have also attached the image
4 5346 bvdet 2,851
Expert Mod 2GB
You have posted a very vague question without showing any effort to solve the problem for yourself. I can give you an answer, but I won't write the code for you.
Create a Tkinter canvas.
Draw a polygon or a series polygons with fill
I attached an example of a canvas with a filled polygon.
bvdet 2,851
Expert Mod 2GB
abhishek07,
I would suggest laying out a grid, say 200x200, over the symbol and record Cartesian points at the vertices and along arcs to approximate the symbol. After that, you can create the filled polygons on a Tkinter canvas. Here's a basic example of creating a Tkinter canvas with filled polygons. - import random
-
from Tkinter import *
-
-
class Pt(object):
-
-
def __init__(self, x=0.0, y=0.0):
-
self.x = float(x)
-
self.y = float(y)
-
-
def __add__(self, other):
-
return Pt(self.x+other.x, self.y+other.y)
-
-
def __sub__(self, other):
-
return Pt(self.x-other.x, self.y-other.y)
-
-
def __mul__(self, f):
-
return Pt(self.x*f, self.y*f)
-
-
def __div__(self, f):
-
return Pt(self.x/f, self.y/f)
-
-
def ray(self, limit):
-
return self, Pt(limit, self.y)
-
-
def __iter__(self):
-
for a in [self.x, self.y]:
-
yield a
-
-
def __str__(self):
-
return 'Pt(%0.4f, %0.4f)' % (self.x,self.y)
-
-
def __repr__(self):
-
return 'Pt(%0.4f, %0.4f)' % (self.x,self.y)
-
-
if __name__ == '__main__':
-
limit = 400
-
pt1 = Pt(random.choice(range(0,limit)), random.choice(range(0,limit)))
-
polygon = [Pt(280,380),
-
Pt(360,20),
-
Pt(100,34),
-
Pt(30,5),
-
Pt(19,240)]
-
-
root = Tk()
-
w = Canvas(root, width=limit+10, height=limit+10)
-
w.create_rectangle(0,0,limit+10,limit+10,fill="#444444444")
-
expandPts = []
-
for pt in polygon:
-
expandPts.append(pt.x)
-
expandPts.append(pt.y)
-
# draw closed polygon
-
polyID = w.create_polygon(*expandPts)
-
w.itemconfig(polyID, fill="#fff000000",
-
activefill="#000000fff",
-
outline="#000000000",
-
width=1)
-
-
# draw ray from random point
-
w.create_line(pt1.x, pt1.y,
-
pt1.ray(limit+10)[1].x,
-
pt1.ray(limit+10)[1].y,
-
fill="#ff0",width=2,
-
activefill='#0f0')
-
# create a blip
-
w.create_line(pt1.x-4, pt1.y-4,
-
pt1.x+4, pt1.y+4,
-
fill="#ffffff",width=2)
-
w.create_line(pt1.x-4, pt1.y+4,
-
pt1.x+4, pt1.y-4,
-
fill="#ffffff",width=2)
-
w.pack()
-
root.mainloop()
bvdet 2,851
Expert Mod 2GB
What the heck - This version is interactive. Left click to select points on the canvas. Right click to draw a polygon and a horizontal ray beginning at a randomly selected point. - import random
-
from Tkinter import *
-
-
class Pt(object):
-
-
def __init__(self, x=0.0, y=0.0):
-
self.x = float(x)
-
self.y = float(y)
-
-
def __add__(self, other):
-
return Pt(self.x+other.x, self.y+other.y)
-
-
def __sub__(self, other):
-
return Pt(self.x-other.x, self.y-other.y)
-
-
def __mul__(self, f):
-
return Pt(self.x*f, self.y*f)
-
-
def __div__(self, f):
-
return Pt(self.x/f, self.y/f)
-
-
def ray(self, limit):
-
return self, Pt(limit, self.y)
-
-
def __iter__(self):
-
for a in [self.x, self.y]:
-
yield a
-
-
def __str__(self):
-
return 'Pt(%0.4f, %0.4f)' % (self.x,self.y)
-
-
def __repr__(self):
-
return 'Pt(%0.4f, %0.4f)' % (self.x,self.y)
-
-
if __name__ == '__main__':
-
limit = 400
-
ptList = []
-
def draw_blip(pt, size):
-
# create a blip
-
w.create_line(pt.x-size, pt.y-size,
-
pt.x+size, pt.y+size,
-
fill="#ffffff",width=2)
-
w.create_line(pt.x-size, pt.y+size,
-
pt.x+size, pt.y-size,
-
fill="#ffffff",width=2)
-
-
def addPts(event):
-
ptList.append(Pt(event.x, event.y))
-
draw_blip(Pt(event.x, event.y), 1)
-
def finish(event):
-
event.widget.unbind("<ButtonRelease-1>")
-
event.widget.unbind("<ButtonRelease-3>")
-
pt1 = Pt(random.choice(range(0,limit)), random.choice(range(0,limit)))
-
expandPts = []
-
for pt in ptList:
-
expandPts.append(pt.x)
-
expandPts.append(pt.y)
-
# draw closed polygon
-
polyID = w.create_polygon(*expandPts)
-
w.itemconfig(polyID, fill="#fff000000",
-
activefill="#000000fff",
-
outline="#000000000",
-
width=1)
-
-
# draw ray from random point
-
w.create_line(pt1.x, pt1.y,
-
pt1.ray(limit+10)[1].x,
-
pt1.ray(limit+10)[1].y,
-
fill="#ff0",width=2,
-
activefill='#0f0')
-
draw_blip(pt1, 4)
-
-
root = Tk()
-
w = Canvas(root, width=limit+10, height=limit+10)
-
w.bind("<ButtonRelease-1>", addPts)
-
w.bind("<ButtonRelease-3>", finish, "+")
-
w.create_rectangle(0,0,limit+10,limit+10,fill="#666")
-
w.pack()
-
root.mainloop()
Sign in to post your reply or Sign up for a free account.
Similar topics
by: carramba |
last post by:
Hi!
Sorry for the stupid subjekt, but coudn't get it better.
I want that the user can chouse the skin of the site that I do by :
**********************************************
<?...
|
by: Stephen Ferg |
last post by:
I use the newsgroup mainly via my Web browser and Google.
Over the last few days, when I click on a link to a thread, I've been
frequently getting the message "Unable to find thread."
Does...
|
by: Dominik Kaspar |
last post by:
i'm used to java and its strict way of defining variables. so how is
it possible to reach something like a class variable in python?
with the following code i didn't have much succes...
class...
|
by: Dan |
last post by:
I am working on a python/zope web application and could really use
some *expert* help on a short term basis.
Is there an appropriate forum for trolling for Python Consultants?
Here are a pair...
|
by: Paul Janssen |
last post by:
Hello!
Can anyone help me out with the following situation:
(a) a single query with 550 id's in the IN-clause resulting into 800+
seconds;
(b) 550 queries with a single id in the IN-clause...
|
by: Lars Netzel |
last post by:
Hey!
I have tried...(in a datagrid)
e.KeyDate.Return
and
e.KeyDate.TAB
end
e.KeyDate.Enter
|
by: Quick |
last post by:
.Value is now .setattribute & .getattribute("name", "value")
What took the place of .Click?
I see .Click is still stated as a method of Forms. I have a
reference "xForm" to the exact form I...
|
by: U S Contractors Offering Service A Non-profit |
last post by:
" Visionary Dreams "
" Leaving New york City leaving to go " GOD noes were
i Don't "
|
by: =?Utf-8?B?VGFsYWxTYWxlZW0=?= |
last post by:
i have facility in my website which sends an e-mail to the cleint's
inbox..... i am getting a problem when ever i sends an e-mail.. i tried with
Hotmail and Yahoo, e-mail goes to the "Junk Mail"...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
| |