Window (tkinter) with no decoration
Hello, programmers! I would like to do a menu bar like kicker or windows menu. is possible? -- Djames Suhanko LinuxUser 158.760 -- http://mail.python.org/mailman/listinfo/python-list
Re: Window (tkinter) with no decoration
Exactly ! I thank you very much, Matimus !!! >> I would like to do a menu bar like kicker or windows menu. is possible? > Maybe you are looking for this? > rt = Tkinter.Tk() > rt.overrideredirect(True) -- Djames Suhanko LinuxUser 158.760 -- http://mail.python.org/mailman/listinfo/python-list
Tkinter - problem closing window
Hello! I'm sorry my terrible english (my native language is portuguese). I has a litle program that open another window. When I close de root window in quit button, I need clicking 2 times to close. is where the problem? The source: 1 #!/usr/bin/env python 2 from Tkinter import * 3 import sys 4 import random 5 class App: 6 def __init__(self, master): 7frame = Frame(master) 8frame.pack() 9rotulo = Label(frame, text="Clique em 'Gerar' e boa sorte!",borderwidth=2,bg="gray",justify=CENTER,relief=SUNKEN) 10rotulo.pack() 11 12self.button = Button(frame, text="Sair", fg="red", command=frame.quit,borderwidth=1) 13self.button.pack(side=LEFT) 14self.hi_there = Button(frame, text="Gerar Numero", command=self.say_hi,borderwidth=1) 15self.hi_there.pack(side=RIGHT,padx=2,pady=2) 16 17 def gera_seis(self): 18a = {} 19for i in range(6): 20 a[i] = "%02d" % int (random.randint(0,60)) 21resultadoA = "%s-%s-%s-%s-%s-%s" % (str(a[0]),str(a[1]),str(a[2]),str(a[3]),str(a[4]),str(a[5])) 22return resultadoA 23 24 def say_hi(self): 25resultado = self.gera_seis() 26raiz = Tk() 27F = Frame(raiz) 28F.pack() 29hello = Label(F, text=resultado) 30hello.pack() 31F.mainloop() 32 33 root = Tk() 34 root.title("$$$ Loteria $$$") 35 app = App(root) 36 root.mainloop() -- Djames Suhanko LinuxUser 158.760 -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter - problem closing window
Wow, nice! But, with join i can't padding with 0. '-'.join(str(random.randint(0, 60)) for dummy in xrange(6)) Then, i has been used: a[i] = "%02d" % int(random.randint(0,60)) I will change int(random.randint(0,60)) for random.randint(0,60), only. Thank you, guys !! ;-) The problem was solved when removed the second "mainloop". I will use the Toplevel instead Tk() again. Thank you for the nice lesson !! On Tue, Jan 6, 2009 at 6:47 AM, Marc 'BlackJack' Rintsch wrote: > On Mon, 05 Jan 2009 12:25:53 -0200, Djames Suhanko wrote: > >> I has a litle program that open another window. When I close de root >> window in quit button, I need clicking 2 times to close. is where the >> problem? >> >> […] >> >> 17 def gera_seis(self): >> 18a = {} >> 19for i in range(6): >> 20 a[i] = "%02d" % int (random.randint(0,60)) >> 21resultadoA = "%s-%s-%s-%s-%s-%s" % >> (str(a[0]),str(a[1]),str(a[2]),str(a[3]),str(a[4]),str(a[5])) >> 22return resultadoA > > Not the problem but unnecessary complex. `random.randint()` already > returns an int, no need to call `int()` on it. The string formatting > with ``%`` returns strings, so there is no need to call `str()` on the > values. Even if the values where not strings: The '%s' place holder > implies a call to `str()` while formatting. If you put something into a > dictionary with consecutive `int` keys, you might use a list instead. > > All this can be written as a simple one liner:: > >'-'.join(str(random.randint(0, 60)) for dummy in xrange(6)) > >> 24 def say_hi(self): >> 25resultado = self.gera_seis() >> 26raiz = Tk() > > The problem is here… > >> 27F = Frame(raiz) >> 28F.pack() >> 29hello = Label(F, text=resultado) 30hello.pack() >> 31F.mainloop() > > …and here. > > There is only one `Tk` instance and mainloop allowed per `Tkinter` > application. Otherwise really strange things can happen. Additional > windows have to be created as `Toplevel` instances. > > Ciao, >Marc 'BlackJack' Rintsch > -- > http://mail.python.org/mailman/listinfo/python-list > -- Djames Suhanko LinuxUser 158.760 -- http://mail.python.org/mailman/listinfo/python-list
pygame error: file is not a windows bmp file
Hello, all! "pygame error: file is not a windows bmp file" I couldn't found a solution for this problem. My python script run fine in local machine using cxfreeze, but don't work when copied to my live linux system. If I put bmp image, works fine, but png don't. Can you help me? (and sorry my terrible english). -- Djames Suhanko LinuxUser 158.760 -- http://mail.python.org/mailman/listinfo/python-list
BMP32 for linux
Hello, all! Did you know the bmp32 module for linux? This module can to load bmp image with alpha channel where is not supported others images formats. But I couldn't to found this module to install in my linux box. :-( do you have tips? Thanks ! -- Djames Suhanko LinuxUser 158.760 -- http://mail.python.org/mailman/listinfo/python-list
Re: BMP32 for linux
Thank you for answer, Scott ! The python in my embbeded system have not support to others formats. :-( Then, I found a tip about bmp32 with alpha channel, but I don't have this module (bmp32) in Ubuntu. I'm using the cx_Freeze to compile my program, but when I put them in my embbeded system, the png images aren't supported anymore. I did use of pygame.image.get_extended() function. In my desktop it return 1, but when put in my system, this function returns 0. Do you have some tip more? Thank you again!! On Mon, Jun 1, 2009 at 12:53 PM, Scott David Daniels wrote: > Djames Suhanko wrote: >> >> Hello, all! >> Did you know the bmp32 module for linux? This module can to load bmp >> image with alpha channel where is not supported others images formats. > > Hmmm, why do you think PNG and TGA do not support alpha? > > --Scott David Daniels > scott.dani...@acm.org > -- > http://mail.python.org/mailman/listinfo/python-list > -- Djames Suhanko LinuxUser 158.760 -- http://mail.python.org/mailman/listinfo/python-list
Re: Remoting over SSH
Hello! I wrote a litle program that send commands to many cluster nodes: #!/usr/bin/env python #By: Djames Suhanko #servers list sincroniza =["server1.domain","server2.domain", "server3.domain"] import pexpect import sys from threading import Thread #the user and pass can be in ini file. #Test parameters list try: if sys.argv[3]: pass except: print "Use: " + "script" + " " sys.exit() #This function send the command in argument def executor(command,username,password,server): a = 'ssh ' + username + '@' + server foo = pexpect.spawn(a) foo.expect('.*ssword:') foo.sendline(password) foo.sendline('su') foo.expect('.*sword:') foo.sendline('root_password_here') foo.sendline(command + '&& exit') print "command to: " + server + "..[OK]" foo.sendline('exit') foo.expect('.*osed.') foo.interact() #make a list tasks = [] #theading loop for i in sincroniza: t = Thread(target=executor,args=(sys.argv[1],sys.argv[2],sys.argv[3],i)) t.start() tasks.append(t) #wait the end for t in tasks: t.join() it's all! On Wed, Jul 8, 2009 at 9:15 AM, Hendrik van Rooyen wrote: > "Hussein B" wrote: > >> Hey, >> I want to perform commands on a remote server over SSH. >> What do I need? >> Thanks. > > Access privileges for the remote machine. > > - Hendrik > > > > -- > http://mail.python.org/mailman/listinfo/python-list > -- Djames Suhanko LinuxUser 158.760 -- http://mail.python.org/mailman/listinfo/python-list
Discovery IP in connection
Hello,all! I wrote a little programa that listening UDP packets. A can receive the messages, but I can't see the the origin IP. How can I to get the remote IP address in connection? My source: #!/usr/bin/env python import socket mySocket = socket.socket ( socket.AF_INET, socket.SOCK_DGRAM ) mySocket.bind ( ( '', 514 ) ) data, addr = mySocket.recvfrom(100) print data -- Djames Suhanko LinuxUser 158.760 -- http://mail.python.org/mailman/listinfo/python-list
Re: Discovery IP in connection
Thanks, all! I didn't tried to print addr. :-( sorry all. I'm learning python yet. Thanks again ! On Mon, Jul 27, 2009 at 8:23 PM, Piet van Oostrum wrote: >>>>>> Djames Suhanko (DS) wrote: > >>DS> Hello,all! >>DS> I wrote a little programa that listening UDP packets. A can receive >>DS> the messages, but I can't see the the origin IP. >>DS> How can I to get the remote IP address in connection? > > What do you think the addr is for in > data, addr = mySocket.recvfrom(100)? > >>DS> My source: > >>DS> #!/usr/bin/env python >>DS> import socket >>DS> mySocket = socket.socket ( socket.AF_INET, socket.SOCK_DGRAM ) >>DS> mySocket.bind ( ( '', 514 ) ) > >>DS> data, addr = mySocket.recvfrom(100) >>DS> print data > > -- > Piet van Oostrum > URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4] > Private email: p...@vanoostrum.org > -- > http://mail.python.org/mailman/listinfo/python-list > -- Djames Suhanko LinuxUser 158.760 -- http://mail.python.org/mailman/listinfo/python-list