Re: Controlling who can run an executable
> What I want: > - the simplest thing that could possibly work! > Have the program check for a file hidden somewhere on the computer. For instance, if the file dummyfile.dll doesn't exist in the windows/system32 folder the program just doesn't start. And when you install the program on her computer just add this file. And if anyone copies the program the can't run it on any other computer because they doesn't know the name of the file that's needed to start the program. How about that? -- http://mail.python.org/mailman/listinfo/python-list
Re: Make Tkinter child window active
It's working, thank you very much :) -- http://mail.python.org/mailman/listinfo/python-list
Make Tkinter child window active
How do i make a child window "active" like the root window? from Tkinter import * def open_child(): c = Toplevel(root) c.title("Child window") c.geometry('200x160+230+130') Label(c, text="Child window").grid() root = Tk() root.title("root window") Button(root, text="Open child window", command=open_child).grid() root.mainloop() When the child windows opens i would like it to be active like the root window, how can i easily do that? -- http://mail.python.org/mailman/listinfo/python-list
replace text in unicode string
I'm having problems replacing text in a unicode string. Here's the code: # -*- coding: cp1252 -*- titel = unicode("ä", "iso-8859-1") print titel print type(titel) titel.replace("ä", "a") When i run this program I get this error: titel.replace("ä", "a") UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position 0: ordinal not in range(128) How can i replace text in the Unicode string? -- http://mail.python.org/mailman/listinfo/python-list
Trouble saving unicode text to file
I'm working on a program that is supposed to save different information to text files. Because the program is in swedish i have to use unicode text for ÅÄÖ letters. When I run the following testscript I get an error message. # -*- coding: cp1252 -*- titel = "åäö" titel = unicode(titel) print "Titel type", type(titel) fil = open("testfil.txt", "w") fil.write(titel) fil.close() Traceback (most recent call last): File "D:\Documents and Settings\Daniel\Desktop\Programmering\aaotest\aaotest2\aaotest2.pyw", line 5, in ? titel = unicode(titel) UnicodeDecodeError: 'ascii' codec can't decode byte 0xe5 in position 0: ordinal not in range(128) I need to have the titel variable in unicode format because when I write åäö in a entry box in Tkinkter it makes the value to a unicode format automaticly. Are there anyone who knows an easy way to save this unicode format text to a file? -- http://mail.python.org/mailman/listinfo/python-list
Problem with variabels in Tkinter
I have a problem with a program i'm making in Tkinter. The code is avaliable at: http://paste.plone.org/943 When i'm running the program and enters a value and press the button in the dialog window that comes up when a press the button "Lägg till spelare" (add a player in swedish) I get this error message: NameError: global name 'entry' is not defined Does anyone know what the problem is? -- http://mail.python.org/mailman/listinfo/python-list
Re: Closing dialog window in Tkinter
Harlin Seritt wrote: > You can add this: > > button = Button(top, text="Close Me", command=top.destroy) > button.pack() > > That will kill the Toplevel window. > > Cheers, > > Harlin Seritt Thank you, it worked great :) -- http://mail.python.org/mailman/listinfo/python-list
Closing dialog window in Tkinter
Hi I'm creating a program in Tkinter and I would need help to create a "close button" for dialog windows. One of my typical dialog windows look like this: def show_window(self): top = Toplevel() Label(top, text="Some text").pack() Label(top, text="Some more text").pack() So what code do i need to insert to create a button that can close this window? If you need to look at some more code from the program to be sure please till me. -- http://mail.python.org/mailman/listinfo/python-list
Problems programming with Tkinter
Hi ! I'm trying to create a graphical program using Tkinter. The program is supposed to save a string the user defines as a filename. I've made it work with the the first button in the program that's named "Spara ett värde i en sträng till ett filnamn", that's swedish for "Save a value in a string as a file name". The button "Skriv ett värde till filen" (swedish for "Write a value to the file") But, i want the program to open a new dialogue when i press the button "Visa ruta" and in that dialogue will be a field where you can enter a value directly in the program, but a can't get it to work because is don't know how i shall do to open a new dialogue window in the program? Is there someone who can help me with my problem? Here's the sourcecode for my program: from Tkinter import * class App: def __init__(self, master): frame = Frame(master) frame.pack() self.hi_there = Button(frame, text="Spara ett värde i en sträng till ett filnamn", command=self.say_hi) self.hi_there.pack(side=LEFT) self.skriv_varde = Button(frame, text="Skriv ett värde till filen", command=self.skriv_varde) self.skriv_varde.pack(side=LEFT) self.visa_ruta = Button(frame, text="Visa ruta", command=self.visa_ruta) self.visa_ruta.pack(side=LEFT) def say_hi(self): print "Sparar fil" S = "filen.fil" output = open(S, 'w') print "Filen sparad" def skriv_varde(self): print "Skriver värde till filen" myfile = open('filen.fil', 'w') myfile.write('Ny mening') myfile.close() print "Värdet till filen skrivet" def visa_ruta(self, parent): top = self.top = Toplevel(parent) Label(top, text="Value").pack() self.e = Entry(top) self.e.pack(padx=5) b = Button(top, text="OK", command=self.ok) b.pack(pady=5) def ok(self): print "value is", self.e.get() self.top.destroy() root = Tk() app = App(root) root.mainloop() -- http://mail.python.org/mailman/listinfo/python-list