I'm having an issue getting python 3.2 to recognize files in ubuntu, it's the first time I've tried to code while running it. A specific example of the issue is when setting an .ico to be a bitmap logo for a Frame in tkinter it's claiming that there it's not defined...

Traceback (most recent call last):
  File "/home/joshua/Python/Python-3.2.2/gpytact17.py", line 1617, in <module>
   [B] start.iconbitmap('pycontlog.ico')[/B]
  File "/usr/lib/python3.1/tkinter/__init__.py", line 1514, in wm_iconbitmap
    return self.tk.call('wm', 'iconbitmap', self._w, bitmap)
_tkinter.TclError: bitmap "pycontlog.ico" not defined

it's very odd to me, it doesn't actually seem like the error is just a matter of an issue finding the file "which is in the same folder by the way", but rather an issue of it claiming that a STRING is not defined. This is not an issue on Windows or Mac, any thoughts?

Just in case there's any confusion yes I bolded the part of the Error that showed my code, it's scary that I have to say that, but I've seen some awful questions around the net about stuff like that lately... Don't worry my Daniweb family, I haven't lost hope in you yet ;)

okay, now a couple more issue have been realized, does focus_set() not work on ubuntu because the window doesn't go to the front nor does the focus get set on what I assign it to, also, SMTP doesn't seem to work nor does webbrowser, this is all pretty odd to me...

because the window doesn't go to the front

You possibly want to provide a takefocus=True parameter, but I have no idea what widget you mean by "window". Without code your questions make no sense. Both SMTP and webbrowser work on my Slackware box.

pardon me woooee I was referring to a Frame, a toplevel window, I focus_set() for clarity I'll show you a bit of an example, which works on Windows, "I'll give takefocus a shot tomorrow, too tired right now

self.upanim=Button(self, text='Upload an image',command=self.con_image)
        self.upanim.grid(row=1,column=4)
        self.submit=Button(self,text='Add',command=self.addme)
        self.submit.bind('<Return>',self.addmejunction)
        self.submit.grid(row=12,column=2,columnspan=3)
    
      def con_image(self):
        self.file1=askopenfilename(filetypes=[('GIF FILES','*.gif'),('JPEG FILES','*.jpg')])
        try:
            self.new_image=ImageTk.PhotoImage(file=self.file1)
            self.picture['image']=self.new_image
            self.picture.grid(row=1,column=2)
            self.submit.focus_set()

Please not that that is not ALL of con_image nor is it all of the Frame, just wanted to show relevant parts.

A toplevel does not automatically take focus. You have to set takefocus=True.

new_gui=Toplevel(root, takefocus=True)

There is nothing about SMTP or webbrowser in the last piece of code you posted, unless you are still trying to get the icon to load, in which case you store the id for the image in what appears to be a dictionary, then apply the entire dictionary to the grid (not the image entry).

self.new_image=ImageTk.PhotoImage(file=self.file1)
self.picture['image']=self.new_image
self.picture.grid(row=1,column=2)     ## self.picture['image'].grid, etc.
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.