473,396 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

tkinter canvas

how to write text on canvas. i know that i need to use canvas.create_text, but
how to write text than when i create_text?
or how to access object ID in canvas and change some options?
thanks in advance!
Apr 18 '07 #1
3 5682
On Apr 18, 3:43 pm, Gigs_ <g...@hi.t-com.hrwrote:
how to write text on canvas. i know that i need to use canvas.create_text, but
how to write text than when i create_text?
or how to access object ID in canvas and change some options?

thanks in advance!
All you need to do is canvas.create_text(x, y, text='Hello World')
where x and y are coordinates on the canvas. You can also add fg and/
or bg to set foreground and background colors, respectively.

Mike

Apr 18 '07 #2
ky******@gmail.com wrote:
On Apr 18, 3:43 pm, Gigs_ <g...@hi.t-com.hrwrote:
>how to write text on canvas. i know that i need to use canvas.create_text, but
how to write text than when i create_text?
or how to access object ID in canvas and change some options?

thanks in advance!

All you need to do is canvas.create_text(x, y, text='Hello World')
where x and y are coordinates on the canvas. You can also add fg and/
or bg to set foreground and background colors, respectively.

Mike
but is there any option to bind event?
when i create text i want to write in text box on canvas so i think that i need
to bind event
Apr 19 '07 #3
On Apr 19, 7:24 am, Gigs_ <g...@hi.t-com.hrwrote:
kyoso...@gmail.com wrote:
On Apr 18, 3:43 pm, Gigs_ <g...@hi.t-com.hrwrote:
how to write text on canvas. i know that i need to use canvas.create_text, but
how to write text than when i create_text?
or how to access object ID in canvas and change some options?
thanks in advance!
All you need to do is canvas.create_text(x, y, text='Hello World')
where x and y are coordinates on the canvas. You can also add fg and/
or bg to set foreground and background colors, respectively.
Mike

but is there any option to bind event?
when i create text i want to write in text box on canvas so i think that i need
to bind event
I'm not sure what you mean. Do you want to type your text into a
textbox and as you type, you want it displayed on the canvas itself as
well? If that is the case, then yes, you'll need to bind an event. If
you just want to type text in a textbox that is on a canvas, the
textbox widget takes care of everything and binding an event is
unnecessary.

Here is some info on events:

http://effbot.org/tkinterbook/tkinte...d-bindings.htm
http://www.builderau.com.au/program/...14t-320000000c
http://www.bembry.org/technology/pyt.../tkinter_3.php

Hope that points you in the right direction.

Mike

Apr 19 '07 #4

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

Similar topics

2
by: mksql | last post by:
New to Tkinter. Initially, I had some code that was executing button commands at creation, rather than waiting for user action. Some research here gave me a solution, but I am not sure why the...
1
by: Elaine Jackson | last post by:
Newbie. Playing with the 'turtle' module and wondering if there's a way to save the graphics you make with it. The documentation itself has nothing to say about this, nor (as far as I can tell)...
1
by: syed_saqib_ali | last post by:
Please take a look at and run the code snippet shown below. It creates a canvas with vertical & Horizontal scroll-bars. If you shrink the window to smaller than the area of the canvas, the...
0
by: syed_saqib_ali | last post by:
Below is a simple code snippet showing a Tkinter Window bearing a canvas and 2 connected scrollbars (Vertical & Horizontal). Works fine. When you shrink/resize the window the scrollbars adjust...
3
by: Tuvas | last post by:
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 #...
5
by: Dean Allen Provins | last post by:
I need to determine the size of a canvas while the process is running. Does anyone know of a technique that will let me do that? Thanks, Dean
4
by: Davy | last post by:
Hi all, I have written a simple Tkinter program, that is draw a rectangle in a canvas, when I press Up key, the rectangle move up. But the program seems work not properly? My environment is...
4
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...
7
by: Peter Pearson | last post by:
Tkinter makes it very easy to drag jpeg images around on a canvas, but I would like to have a "target" change color when the cursor dragging an image passes over it. I seem to be blocked by the...
3
by: joshdw4 | last post by:
I hate to do this, but I've thoroughly exhausted google search. Yes, it's that pesky root window and I have tried withdraw to no avail. I'm assuming this is because of the methods I'm using. I...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.