473,785 Members | 2,720 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Change coords of a canvas.line item

Hi all,

I want to change the beginning/end-coordinates of a canvas.line item.

Something like:

self.myCanvas.i temconfigure(it em_id, coords=(x1_new, y1_new, x2_new,
y2_new))

I don't want to delete and repaint a new line item. Is this possible?

Thanks

Matthias

Jan 5 '07 #1
3 12569
Matthias Vodel wrote:
I want to change the beginning/end-coordinates of a canvas.line item.

Something like:

self.myCanvas.i temconfigure(it em_id, coords=(x1_new, y1_new, x2_new, y2_new))
self.myCanvas.c oords(item_id, x1_new, y1_new, x2_new, y2_new)

</F>

Jan 5 '07 #2
Very nice :)

Thank you,

Matthias
Jan 5 '07 #3
Fredrik Lundh wrote:
Matthias Vodel wrote:
>I want to change the beginning/end-coordinates of a canvas.line item.

Something like:

self.myCanvas. itemconfigure(i tem_id, coords=(x1_new, y1_new, x2_new, y2_new))

self.myCanvas.c oords(item_id, x1_new, y1_new, x2_new, y2_new)
You can also use insert and dchars methods to add and delete
vertices (useful for polylines/polygons).

w.
Jan 5 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
7675
by: Gary Richardson | last post by:
I've been working on a Python version of Andreas Weber's ASCII schematic drawing program ( http://www.tech-chat.de) ; not that I thought I could do it better but just as a programming exercise. I've managed to put together something that more or less works but I'm puzzled by the way ASCII characters are displayed on a Canvas window. For example, in the code below (which produces my crude representation of an OpAmp), why are two leading...
4
4166
by: Peter Otten | last post by:
Is there a way to limit both width and height of a canvas text item? My current workaround seems clumsy: import Tkinter as tk root = tk.Tk() canvas = tk.Canvas(root, width=400, height=200, bg="white") canvas.pack() # simulate a clipped text item - never transparent :-( s = "The long and winding road.."
1
5362
by: Dave Harris | last post by:
I have written a reasonably clean way to perform coordinate transformations on a polygon, but Tkinter Canvas is not being particularly cooperative. The following program has been distilled down to a minimum and generates a traceback (see below) when it runs. It appears that the create_polygon() method is more versatile than the coords() method. Could someone can suggest a way to have the list comprehension not generate tuples, that...
1
3658
by: Brett | last post by:
I'm trying to load a xbm formatted string as a bitmap and draw it to a canvas....I don't have any trouble with loading/displaying xbm files, it's when I've pre-created the xbm as a string I get a 'can't find your bitmap error' <created my canvas and I draw other objects that are displayed correctly> xbm_string = "#define arrow_width 1 #define arrow_height 16 static char arrow_bits = {
1
3013
by: Ben Bush | last post by:
I tested the following code and wanted to make oval 2 become red after I hit the enter key but though the code did not report error, it did not change. from Tkinter import * root=Tk() canvas=Canvas(root,width=100,height=100) canvas.pack() canvas.create_oval(10,10,20,20,tags='oval1',fill='blue') canvas.create_oval(50,50,80,80,tags='oval2',fill='yellow') def turnRed(self, event):
6
3563
by: Nebulism | last post by:
I have been attempting to utilize a draw command script that loads a canvas, and through certain mouse events, draws rectangles. The original code is from http://www.java2s.com/Code/Python/Event/Usemousetodrawashapeoncanvas.htm . The code itself is: from Tkinter import * trace = 0 class CanvasEventsDemo: def __init__(self, parent=None): canvas = Canvas(width=300, height=300, bg='beige') canvas.pack()
4
9144
by: skanemupp | last post by:
mapq = PhotoImage(file = 'C:\Users\saftarn\Desktop\elmapovic.gif') w.create_image(10, 10, image = mapq, anchor = NW) after doing this is there any possibility of getting the characteristics of the GIF-picture(or bitmap if i use that)? it would be very helpfull if i for example could do something like canvas.getcolor(image, mouseclick.x,mouseclick.y) if u get the point. get the color of the image where i clicked.
10
7371
by: blaine | last post by:
Hey everyone! I'm not very good with Tk, and I am using a very simple canvas to draw some pictures (this relates to that nokia screen emulator I had a post about a few days ago). Anyway, all is well, except one thing. When I am not in the program, and the program receives a draw command (from a FIFO pipe), the canvas does not refresh until I click into the program. How do I force it to refresh, or force the window to gain focus? It...
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10155
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10095
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8978
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6741
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5383
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5513
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4054
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3655
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.