473,796 Members | 2,544 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

tkinter canvas bitmaps w/ xbm formated string data?

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[] = {
0x01,0x01,0x01, 0x01,0x01,0x01, 0x01,0x01,0x01, 0x01,0x01,0x01, 0x01,0x01,0x01, 0x01
};"

a_bitmap = Tkinter.BitmapI mage(data=xbm_s tring)

print a_bitmap.width( ) #prints out 1
print a_bitmap.height () #print out 16

canvas.create_b itmap(100,100, bitmap=a_bitmap ) #if I used
bitmap="@line.x bm" with the exact same string as defined above, the
xbm is displayed correctly.
When the create_bitmap executes I get:
File "C:\June 5th datamaster\colo rlabel.py", line 360, in
_createtext
self.canvas.cre ate_bitmap(100, 100, bitmap=a_bitmap )
File "<string>", line 1, in create_bitmap
File "C:\Python23\li b\lib-tk\Tkinter.py", line 2057, in
create_bitmap
return self._create('b itmap', args, kw)
File "C:\Python23\li b\lib-tk\Tkinter.py", line 2049, in _create
return getint(self.tk. call(
TclError: bitmap "pyimage1" not defined

....I have a feeling that I somehow lost a reference to my bitmap
object...I'm not sure what's happening.

any ideas what could be wrong?

Brett
Jul 18 '05 #1
1 3658
Brett wrote:
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' ...I have a feeling that I somehow lost a reference to my bitmap
object...I'm not sure what's happening.

any ideas what could be wrong?
No, but

canvas.create_i mage(100, 100, image=a_bitmap)

instead of
canvas.create_b itmap(100,100, bitmap=a_bitmap ) #if I used


seems to work.

Peter

Jul 18 '05 #2

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

Similar topics

1
4550
by: Peter Otten | last post by:
Before I start moving them into dark corners of the canvas - is there a way to hide/show Tkinter canvas items without having to maintain their original position externally? All I've found so far is sortvisu.py in the demos that toggles their coordinates between (0,0,0,0) and the real position/size. Thanks, Peter
1
10743
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) does the FAQ list at python-dot-org. Any pointers would be very much appreciated. (In related news, I would also like to find out what's going on with "bounding boxes" in image files - not having them is keeping me from including images in latex...
1
2470
by: Erik Johnson | last post by:
I want to draw some simple (dynamic) graphs and get these saved as a JPEG file to reference in a web link. I am aware of PIL (Python Image Library), but unfortunatley my system does not have it built. After looking at the README for it and seeing it depends on two separate packages to support JPEG and TrueType font, I though maybe there was an easier way. Tkinter is currently built and working on my Python 2.2.2 installation. Is there...
0
1344
by: Shi Mu | last post by:
got confused by x, y coordinates in Tkinter canvas. from left to right, does X increase? from top to bottom, does y increase?
3
4498
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 # args: should be ".-1211472948 .-1211470996 addtag tag searchCommand ?arg arg ...? My code works like this: if (pic):
5
15001
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
0
299
by: fxe | last post by:
Hi, I am using tkinter and I have a canvas that with several rectangles drawn on it. The rectangles need to have bindings to move and resize them. No problem here, but I also need to display a grid on the same canvas, for which I am using create_line. My problem is I do not want the grid lines to be able to move and resize . Is this doable or any suggestions on an alternative.Maybe another way to display my grid on top of the canvas?
0
2494
by: WaterWalk | last post by:
Hello. When I tried to make Tkinter canvas widget respond to MouseWheel event on Windows XP, I failed. The canvas just doesn't receive MouseWheel event. I used bind_all to find out which widget receives this event and the result showed that only the top Tk widget gets it. This is really annoying. I wonder if this problem exists on other platform. I googled, but found no appliable solution, so I wrote one as following. It's not perfect,...
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.
0
9680
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
9528
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10230
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
10174
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
10012
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7548
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6788
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
5442
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...
2
3731
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.