LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-09-2003, 12:14 PM   #1
Gerardoj
Member
 
Registered: May 2003
Location: Somewhere over the Rainbow
Distribution: Slackware 9.x, Knoppix, Damn Small Linux, RedHat.
Posts: 465

Rep: Reputation: 30
Python Add Image


Hi, I would like some help to add an image to my button, this is my toolbar code: Python code:

Code:
self.toolbar = Frame(self.window)
        
        self.new = Button(self.toolbar, text="New", width=6, command=self.new, relief=RIDGE)
        self.new.pack(side=LEFT, padx=2, pady=2)
Thanks a lot.

Last edited by Gerardoj; 11-09-2003 at 12:21 PM.
 
Old 11-09-2003, 03:41 PM   #2
runen
LQ Newbie
 
Registered: Nov 2003
Location: Norway
Distribution: Debian on one machine and Slacky on another.
Posts: 9

Rep: Reputation: 0
Look at http://www.nmt.edu/tcc/help/lang/python/tkinter.pdf - A tkinter reference (I assume that's what you're using).

I think you have to add a bitmap option in the creation of the button. Where the value of bitmap= is a bitmap, perhaps created by Canvas?? Look it up!
 
Old 11-09-2003, 04:24 PM   #3
Gerardoj
Member
 
Registered: May 2003
Location: Somewhere over the Rainbow
Distribution: Slackware 9.x, Knoppix, Damn Small Linux, RedHat.
Posts: 465

Original Poster
Rep: Reputation: 30
Thanks for your reply, I added with

self.toolbar = Frame(self.window)
image=PhotoImage(file='/home/neo/Images/new.gif')

self.new = Button(self.toolbar,image=image,width=40, command=self.new, relief=RIDGE)
self.new.pack(side=LEFT, padx=2, pady=2)


self.toolbar.pack(side=TOP, fill=X)
self.window.mainloop()
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How add a loopback DVD iso image to fstab?? carl0ski Linux - General 3 09-02-2011 02:55 PM
add image to protected directories login box tommytomato Linux - Newbie 2 05-25-2004 08:37 AM
How can i add files 2 an iso image? Braveheart1980 Linux - Software 4 02-29-2004 06:30 PM
How to Add Text to An Image? VorlonInfoTech Linux - Software 1 02-01-2004 09:23 PM
How may I add a file to an ISO image? geraldomanaus Linux - Newbie 6 04-24-2003 05:27 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration