Re: [python] spusteni programu s parametry

2014-02-11 Tema obsahu Visgean Skeloru
Docela zajímavý je taky Komandr: https://github.com/kadirpekel/komandr jen
ten vyvoj docela ustal.


2014-02-10 23:53 GMT+01:00 starenka . staren...@gmail.com:

 Ahoj,

 no nevim, me to funguje...

 starenka /tmp % cat meh.py
 #!/usr/bin/env python
 # coding=utf-8

 import sys

 print sys.argv
 starenka /tmp % python meh.py -20
 ['meh.py', '-20']

 BTW koukni se spis na argparse (stdlib) nebo docopt (pip /
 https://github.com/docopt/docopt)

 s.
 ---
 In Perl you shoot yourself in the foot, but nobody can understand how
 you did it. Six months later, neither can you. | print
 'aknerats'[::-1]


 2014-02-10 23:47 GMT+01:00 pythoncaha pythonc...@gmail.com:
  Zdravim vsechny, nemuzu prekonat nasledujici problem, snad nekdo
 poradi...
 
  Spoustim program  program.py -20   tedy s parametrem  minus20.
  Ale sys.argv[1] mi hodnotu minus 20 nedava.
 
  Jak toho docilit.
 
  diky Ondra
 
  ___
  Python mailing list
  python@py.cz
  http://www.py.cz/mailman/listinfo/python
 
  Visit: http://www.py.cz
 ___
 Python mailing list
 python@py.cz
 http://www.py.cz/mailman/listinfo/python

 Visit: http://www.py.cz




-- 
github/visgean http://github.com/Visgean
___
Python mailing list
python@py.cz
http://www.py.cz/mailman/listinfo/python

Visit: http://www.py.cz

Re: [python] Entry čtení vstupu

2014-02-11 Tema obsahu Roman Zbořil
Moje řešení, mého vlastního dotazu :-)

# -*- coding: utf-8 -*- 
from tkinter import *


hlavni = Tk()
hlavni.option_add('*Font', 'Arial 9')  # aby byl lepsi font

vstupObsah=StringVar()
vstupObsah.set(1)
vstupObsah2=StringVar()

def cteni(entry):

vstupObsah2.set(eval(vstup.get())+1)
hlavni.update_idletasks()

vstup = Entry(hlavni, textvariable=vstupObsah, width=40, )
vstup.pack(side=LEFT)
vstup.focus_set()   # aby se dalo hned psát
vstup.icursor(END)  # aby byl kurzor na konci
vstup.bind(sequence='KeyRelease', func=cteni)

vstup2 = Entry(hlavni, textvariable=vstupObsah2,)
vstup2.pack(side=LEFT)

tlacitko = Button(hlavni, text=upřečti, width=10, command=cteni)
tlacitko.pack()

mainloop()
___
Python mailing list
python@py.cz
http://www.py.cz/mailman/listinfo/python

Visit: http://www.py.cz


Re: [python] spusteni programu s parametry

2014-02-11 Tema obsahu pythoncaha

Diky za reakci, problem byl v pouzit getopt


Subject: Re: [python] spusteni programu s parametry


Ahoj,

no nevim, me to funguje...

starenka /tmp % cat meh.py
#!/usr/bin/env python
# coding=utf-8

import sys

print sys.argv
starenka /tmp % python meh.py -20
['meh.py', '-20']

BTW koukni se spis na argparse (stdlib) nebo docopt (pip /
https://github.com/docopt/docopt)

s.
---
In Perl you shoot yourself in the foot, but nobody can understand how
you did it. Six months later, neither can you. | print
'aknerats'[::-1]


2014-02-10 23:47 GMT+01:00 pythoncaha pythonc...@gmail.com:

Zdravim vsechny, nemuzu prekonat nasledujici problem, snad nekdo poradi...

Spoustim program  program.py -20   tedy s parametrem  minus20.
Ale sys.argv[1] mi hodnotu minus 20 nedava.

Jak toho docilit.

diky Ondra

___
Python mailing list
python@py.cz
http://www.py.cz/mailman/listinfo/python

Visit: http://www.py.cz

___
Python mailing list
python@py.cz
http://www.py.cz/mailman/listinfo/python

Visit: http://www.py.cz 


___
Python mailing list
python@py.cz
http://www.py.cz/mailman/listinfo/python

Visit: http://www.py.cz