[TKinter]How to set LabelFrames font and color from option file

2017-12-14 Thread Beppe

Hi to everybody, 

I don't succeed in planning the value of the font and color in the LabelFrames 
using the option_db file, such as

*LabelFrame*font: Helvetica 14
*LabelFrame*foreground: red

exist a list of the keywordses to use?

thanks

beppe
-- 
https://mail.python.org/mailman/listinfo/python-list


write your replace function in python

2017-12-14 Thread ayaskant . mantu111
Hi,

I want to replace the spaces in a sting with hyphen with my own replace 
function or with using the pre-defined replace function.
Can anybody help me with this issue???

Thanks
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: write your replace function in python

2017-12-14 Thread Chris Angelico
On Thu, Dec 14, 2017 at 9:08 PM,   wrote:
> Hi,
>
> I want to replace the spaces in a sting with hyphen with my own replace 
> function or with using the pre-defined replace function.
> Can anybody help me with this issue???
>

Ahh, the old "I want to" as a prefix for a homework assignment.

Start by having a good-faith attempt to solve the problem on your own
- spend maybe 30 to 60 minutes on it. At the end of that time, you
might not have fully-working code, but you should at least have some
code to talk about. Figure out what's working and what's not working,
and *then* ask for help.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Answers to homework questions [WAS]: Re: Python homework

2017-12-14 Thread Lorenzo Sutton

Hi Roger,

On 13/12/17 23:31, ROGER GRAYDON CHRISTMAN wrote:

On Wed, Dec 13, 2017, Lorenzo Sutton wrote:



On 05/12/17 06:33, nick martinez2 via Python-list wrote:
I have a question on my homework. 

[...]

For this kind of problem I think the collections module [1] can be very
useful. In this case in particular have a look at the Counter package ;)

[...]


A nice answer at face value, and for general questions, but
perhaps not the best given the subject line and the first sentence
in the OP's note.

>
[...]

When I teach my course, I have no desire to have
all my students turn into cargo cultists.

At least this particular student did post his intended solution,
instead of outright begging for code.  And most of the responses
I see did attempt to work within the perceived constraints
regarding what language tools the student was expected to use.


I see your point as a teacher, but after all this *is* a Python mailing 
list and not a python-homework-support mailing list.


Plus, the OP had already received various good answers specifically 
helping them solve the problem along the lines of his proposed code, so 
I guessed hinting to a standard library module which is interesting and 
potentially relevant in this case might be useful to both the OP and 
other people on the ML while enriching the discussion ;-)


Best,
Lorenzo.
--
https://mail.python.org/mailman/listinfo/python-list


Re: Please tell me how to execute python file in Ubuntu by double

2017-12-14 Thread Rhodri James

On 14/12/17 07:25, Chris Angelico wrote:

So it's an imperfect solution even as far as it goes, and a highly
limiting way to do things. I'm sure it made good sense back when
MS-DOS file systems ruled the Windows world, and 8.3 was just the way
of things.


Even then there was RiscOS, which divorced file names from file types 
entirely.  A file's type was part of its directory data, and that was 
what determined what happened when you double-clicked on it.  You were 
still limited to only one default application (and icon, and so on) per 
file type, so OS/2 still wins on that front, but I always felt that 
having names determine types was somehow mucky.


--
Rhodri James *-* Kynesim Ltd
--
https://mail.python.org/mailman/listinfo/python-list


Re: Answers to homework questions [WAS]: Re: Python homework

2017-12-14 Thread Rhodri James

On 14/12/17 10:22, Lorenzo Sutton wrote:

Hi Roger,

On 13/12/17 23:31, ROGER GRAYDON CHRISTMAN wrote:

On Wed, Dec 13, 2017, Lorenzo Sutton wrote:



On 05/12/17 06:33, nick martinez2 via Python-list wrote:
I have a question on my homework. 

[...]

For this kind of problem I think the collections module [1] can be very
useful. In this case in particular have a look at the Counter package ;)

[...]


A nice answer at face value, and for general questions, but
perhaps not the best given the subject line and the first sentence
in the OP's note.

 >
[...]

When I teach my course, I have no desire to have
all my students turn into cargo cultists.

At least this particular student did post his intended solution,
instead of outright begging for code.  And most of the responses
I see did attempt to work within the perceived constraints
regarding what language tools the student was expected to use.


I see your point as a teacher, but after all this *is* a Python mailing 
list and not a python-homework-support mailing list.


That implies you shouldn't have answered a homework assignment at all :-p

--
Rhodri James *-* Kynesim Ltd
--
https://mail.python.org/mailman/listinfo/python-list


Re: Please tell me how to execute python file in Ubuntu by double

2017-12-14 Thread Chris Angelico
On Thu, Dec 14, 2017 at 10:53 PM, Rhodri James  wrote:
> On 14/12/17 07:25, Chris Angelico wrote:
>>
>> So it's an imperfect solution even as far as it goes, and a highly
>> limiting way to do things. I'm sure it made good sense back when
>> MS-DOS file systems ruled the Windows world, and 8.3 was just the way
>> of things.
>
>
> Even then there was RiscOS, which divorced file names from file types
> entirely.  A file's type was part of its directory data, and that was what
> determined what happened when you double-clicked on it.  You were still
> limited to only one default application (and icon, and so on) per file type,
> so OS/2 still wins on that front, but I always felt that having names
> determine types was somehow mucky.
>

Having names as the *sole* way to determine types? I agree. But as one
of a suite of methods? It makes a decent default. There are plenty of
files out there whose names correctly match (a) their contents and (b)
what you want to do with them, so forcing people to ALSO choose a type
in some other way is redundant. But if a file can have an explicit
type or "no type specified", and in the latter case it uses a
filename-based mapping, that would be a slab of the functionality
right there.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Answers to homework questions [WAS]: Re: Python homework

2017-12-14 Thread Rustom Mody
On Thursday, December 14, 2017 at 3:53:21 PM UTC+5:30, Lorenzo Sutton wrote:
> Hi Roger,
> 
> On 13/12/17 23:31, ROGER GRAYDON CHRISTMAN wrote:
> > On Wed, Dec 13, 2017, Lorenzo Sutton wrote:
> >>
> > On 05/12/17 06:33, nick martinez2 via Python-list wrote:
> >>> I have a question on my homework. 
> [...]
> >> For this kind of problem I think the collections module [1] can be very
> >> useful. In this case in particular have a look at the Counter package ;)
> [...]
> > 
> > A nice answer at face value, and for general questions, but
> > perhaps not the best given the subject line and the first sentence
> > in the OP's note.
>  >
> [...]
> > When I teach my course, I have no desire to have
> > all my students turn into cargo cultists.
> > 
> > At least this particular student did post his intended solution,
> > instead of outright begging for code.  And most of the responses
> > I see did attempt to work within the perceived constraints
> > regarding what language tools the student was expected to use.
> 
> I see your point as a teacher, but after all this *is* a Python mailing 
> list and not a python-homework-support mailing list.
> 
> Plus, the OP had already received various good answers specifically 
> helping them solve the problem along the lines of his proposed code, so 
> I guessed hinting to a standard library module which is interesting and 
> potentially relevant in this case might be useful to both the OP and 
> other people on the ML while enriching the discussion ;-)

Somebody has already pointed out that some setting in Roger Christman's 
mail client(?) breaks discussion threads.
Now either Lorenzo is also breaking threads…
Or else something in Roger's post makes the next person (in this case Lorenzo)
break the thread¿?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Answers to homework questions [WAS]: Re: Python homework

2017-12-14 Thread Rustom Mody
On Thursday, December 14, 2017 at 7:02:56 PM UTC+5:30, Rustom Mody wrote:
> On Thursday, December 14, 2017 at 3:53:21 PM UTC+5:30, Lorenzo Sutton wrote:
> > Hi Roger,
> > 
> > On 13/12/17 23:31, ROGER GRAYDON CHRISTMAN wrote:
> > > On Wed, Dec 13, 2017, Lorenzo Sutton wrote:
> > >>
> > > On 05/12/17 06:33, nick martinez2 via Python-list wrote:
> > >>> I have a question on my homework. 
> > [...]
> > >> For this kind of problem I think the collections module [1] can be very
> > >> useful. In this case in particular have a look at the Counter package ;)
> > [...]
> > > 
> > > A nice answer at face value, and for general questions, but
> > > perhaps not the best given the subject line and the first sentence
> > > in the OP's note.
> >  >
> > [...]
> > > When I teach my course, I have no desire to have
> > > all my students turn into cargo cultists.
> > > 
> > > At least this particular student did post his intended solution,
> > > instead of outright begging for code.  And most of the responses
> > > I see did attempt to work within the perceived constraints
> > > regarding what language tools the student was expected to use.
> > 
> > I see your point as a teacher, but after all this *is* a Python mailing 
> > list and not a python-homework-support mailing list.
> > 
> > Plus, the OP had already received various good answers specifically 
> > helping them solve the problem along the lines of his proposed code, so 
> > I guessed hinting to a standard library module which is interesting and 
> > potentially relevant in this case might be useful to both the OP and 
> > other people on the ML while enriching the discussion ;-)
> 
> Somebody has already pointed out that some setting in Roger Christman's 
> mail client(?) breaks discussion threads.
> Now either Lorenzo is also breaking threads…
> Or else something in Roger's post makes the next person (in this case Lorenzo)
> break the thread¿?

Didn't notice that Lorenzo had renamed the subject line
Sorry for noise
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [TKinter]How to set LabelFrames font and color from option file

2017-12-14 Thread Gene Heskett
On Thursday 14 December 2017 04:35:02 Beppe wrote:

> Hi to everybody,
>
> I don't succeed in planning the value of the font and color in the
> LabelFrames using the option_db file, such as
>
> *LabelFrame*font: Helvetica 14
> *LabelFrame*foreground: red
>
> exist a list of the keywordses to use?
>
> thanks
>
> beppe

In pyvcp, the xml file can have:


("Helvetica",16)
...


It has a default, which I haven't changed, but the above

("Helvetica",12)

 s/b how you do it.

Cheers, Gene Heskett
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [TKinter]How to set LabelFrames font and color from option file

2017-12-14 Thread Peter Otten
Beppe wrote:

> I don't succeed in planning the value of the font and color in the
> LabelFrames using the option_db file, such as
> 
> *LabelFrame*font: Helvetica 14
> *LabelFrame*foreground: red
> 
> exist a list of the keywordses to use?

>>> import tkinter as tk
>>> root = tk.Tk()
>>> lf = tk.LabelFrame(root)
>>> lf["class"]
'Labelframe'

Do you spot the difference? The class of the LabelFrame widget is Labelframe 
with a lowercase f. Once you change your database entries to

*Labelframe*font: Helvetica 14
*Labelframe*foreground: red

everything should work as expected.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [TKinter]How to set LabelFrames font and color from option file

2017-12-14 Thread Beppe
Il giorno giovedì 14 dicembre 2017 15:18:31 UTC+1, Peter Otten ha scritto:
> Beppe wrote:
> 
> > I don't succeed in planning the value of the font and color in the
> > LabelFrames using the option_db file, such as
> > 
> > *LabelFrame*font: Helvetica 14
> > *LabelFrame*foreground: red
> > 
> > exist a list of the keywordses to use?
> 
> >>> import tkinter as tk
> >>> root = tk.Tk()
> >>> lf = tk.LabelFrame(root)
> >>> lf["class"]
> 'Labelframe'
> 
> Do you spot the difference? The class of the LabelFrame widget is Labelframe 
> with a lowercase f. Once you change your database entries to
> 
> *Labelframe*font: Helvetica 14
> *Labelframe*foreground: red
> 
> everything should work as expected.

perfect, it works too much well, even my buttons now are helvetica 14 and red  
;(
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [TKinter]How to set LabelFrames font and color from option file

2017-12-14 Thread Peter Otten
Beppe wrote:

> Il giorno giovedì 14 dicembre 2017 15:18:31 UTC+1, Peter Otten ha scritto:
>> Beppe wrote:
>> 
>> > I don't succeed in planning the value of the font and color in the
>> > LabelFrames using the option_db file, such as
>> > 
>> > *LabelFrame*font: Helvetica 14
>> > *LabelFrame*foreground: red
>> > 
>> > exist a list of the keywordses to use?
>> 
>> >>> import tkinter as tk
>> >>> root = tk.Tk()
>> >>> lf = tk.LabelFrame(root)
>> >>> lf["class"]
>> 'Labelframe'
>> 
>> Do you spot the difference? The class of the LabelFrame widget is
>> Labelframe with a lowercase f. Once you change your database entries to
>> 
>> *Labelframe*font: Helvetica 14
>> *Labelframe*foreground: red
>> 
>> everything should work as expected.
> 
> perfect, it works too much well, even my buttons now are helvetica 14 and
> red  ;(

I does what you tell it to do. Remove the second wildcard if you only want 
to change the Labelframe style:

*Labelframe.font: Helvetica 14
*Labelframe.foreground: red


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please tell me how to execute python file in Ubuntu by double

2017-12-14 Thread Chris Angelico
On Fri, Dec 15, 2017 at 3:06 AM, Dennis Lee Bieber
 wrote:
> C:\Users\Wulfraed>assoc .docx
> .docx=Word.Document.12
>
> C:\Users\Wulfraed>ftype word.document.12
> word.document.12="C:\Program Files\Microsoft
> Office\Root\Office16\WINWORD.EXE" /n "%1" /o "%u"

I'm almost afraid to ask... why "word.document.12" and why "Office16"?
If only one of those, I would guess that it's a version number
("Office16" ==> MS Office 2016?), but there are two of them and they
disagree...

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [TKinter]How to set LabelFrames font and color from option file

2017-12-14 Thread Beppe
Il giorno giovedì 14 dicembre 2017 16:36:24 UTC+1, Peter Otten ha scritto:
> Beppe wrote:
> 
> > Il giorno giovedì 14 dicembre 2017 15:18:31 UTC+1, Peter Otten ha scritto:
> >> Beppe wrote:
> >> 
> >> > I don't succeed in planning the value of the font and color in the
> >> > LabelFrames using the option_db file, such as
> >> > 
> >> > *LabelFrame*font: Helvetica 14
> >> > *LabelFrame*foreground: red
> >> > 
> >> > exist a list of the keywordses to use?
> >> 
> >> >>> import tkinter as tk
> >> >>> root = tk.Tk()
> >> >>> lf = tk.LabelFrame(root)
> >> >>> lf["class"]
> >> 'Labelframe'
> >> 
> >> Do you spot the difference? The class of the LabelFrame widget is
> >> Labelframe with a lowercase f. Once you change your database entries to
> >> 
> >> *Labelframe*font: Helvetica 14
> >> *Labelframe*foreground: red
> >> 
> >> everything should work as expected.
> > 
> > perfect, it works too much well, even my buttons now are helvetica 14 and
> > red  ;(
> 
> I does what you tell it to do. Remove the second wildcard if you only want 
> to change the Labelframe style:
> 
> *Labelframe.font: Helvetica 14
> *Labelframe.foreground: red

Does that mean buttons  inerith text from labelframe?!?! it looks so.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [TKinter]How to set LabelFrames font and color from option file

2017-12-14 Thread Beppe
Il giorno giovedì 14 dicembre 2017 17:29:36 UTC+1, Beppe ha scritto:
> Il giorno giovedì 14 dicembre 2017 16:36:24 UTC+1, Peter Otten ha scritto:
> > Beppe wrote:
> > 
> > > Il giorno giovedì 14 dicembre 2017 15:18:31 UTC+1, Peter Otten ha scritto:
> > >> Beppe wrote:
> > >> 
> > >> > I don't succeed in planning the value of the font and color in the
> > >> > LabelFrames using the option_db file, such as
> > >> > 
> > >> > *LabelFrame*font: Helvetica 14
> > >> > *LabelFrame*foreground: red
> > >> > 
> > >> > exist a list of the keywordses to use?
> > >> 
> > >> >>> import tkinter as tk
> > >> >>> root = tk.Tk()
> > >> >>> lf = tk.LabelFrame(root)
> > >> >>> lf["class"]
> > >> 'Labelframe'
> > >> 
> > >> Do you spot the difference? The class of the LabelFrame widget is
> > >> Labelframe with a lowercase f. Once you change your database entries to
> > >> 
> > >> *Labelframe*font: Helvetica 14
> > >> *Labelframe*foreground: red
> > >> 
> > >> everything should work as expected.
> > > 
> > > perfect, it works too much well, even my buttons now are helvetica 14 and
> > > red  ;(
> > 
> > I does what you tell it to do. Remove the second wildcard if you only want 
> > to change the Labelframe style:
> > 
> > *Labelframe.font: Helvetica 14
> > *Labelframe.foreground: red
> 
> Does that mean buttons  inerith text from labelframe?!?! it looks so.

ok, so it seems working

*Labelframe*font: Helvetica 14
*Labelframe*foreground: red

*Button*foreground: black
*Button*font: Verdana 10
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python homework

2017-12-14 Thread edmondo . giovannozzi
Il giorno martedì 12 dicembre 2017 00:30:24 UTC+1, jlad...@itu.edu ha scritto:
> On Thursday, December 7, 2017 at 4:49:52 AM UTC-8, edmondo.g...@gmail.com 
> wrote:
> 
> >   import numpy
> 
> I teach Python to students at varying levels.  As much as I love and use 
> Numpy in my regular work, I try to avoid showing beginning Python students 
> solutions that require third-party packages.  Here are my reasons:
> 
> 1. Not every programming novice needs to understand things at the 
> bits-and-bytes level, but they should learn the inner workings of algorithms. 
>  You won't always have a ready-made algorithm to solve your problem in a 
> library function call, so you should learn to write your own.
> 
> 2. Package maintenance can be its own headache.  Sure, Anaconda can help, but 
> it's a heavyweight distribution.  And not every student is working on a 
> computer where they have the rights to install software.

I understand you points, on the other end, as we are not his teachers, we can 
also suggest other ways to solve its problem. 

Look that I haven't posted a complete solution, I just stopped at the same 
point he had already reached, and then I had given him just hints.

I think there is also another lessons that a student should learn: not to 
reinvent the wheel. But it may just be my feeling about this issue. 

I think also that introducing third-party package or not depends on the student 
environment. If he is studying to become an engineer he may have already been 
exposed to other proprietary software (the famous one). It could be useful to 
show him that most of the same things can be done in python with just an almost 
standard third-party package.

Cheers,
Edmondo


-- 
https://mail.python.org/mailman/listinfo/python-list


subprocess call question

2017-12-14 Thread Wanderer
This dos batch files works on windows 7

"C:\Program Files (x86)\DOOM 3\qoom3.exe" +set fs_game_base darkmod +set 
fs_game training_mission

but this python subprocess.call doesn't

subprocess.call(['C:/Program Files (x86)/DOOM 3/qoom3.exe', '+set fs_game_base 
darkmod', '+set fs_game training_mission'])

qoom3.exe starts but it gives the warnings "unknown commands set fs_game_base 
darkmod and set fs_game training_mission"

Why?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: subprocess call question

2017-12-14 Thread MRAB

On 2017-12-14 17:35, Wanderer wrote:

This dos batch files works on windows 7

"C:\Program Files (x86)\DOOM 3\qoom3.exe" +set fs_game_base darkmod +set 
fs_game training_mission

but this python subprocess.call doesn't

subprocess.call(['C:/Program Files (x86)/DOOM 3/qoom3.exe', '+set fs_game_base 
darkmod', '+set fs_game training_mission'])

qoom3.exe starts but it gives the warnings "unknown commands set fs_game_base 
darkmod and set fs_game training_mission"

Why?

Each of the strings in the list will be quoted, so the command line 
you're actually giving it is:


"C:/Program Files (x86)/DOOM 3/qoom3.exe" "+set fs_game_base darkmod" 
"+set fs_game training_mission"


hence it's complaining that there's no command "+set fs_game_base darkmod".

The call should be:

subprocess.call(['C:/Program Files (x86)/DOOM 3/qoom3.exe', '+set', 
'fs_game_base', 'darkmod', '+set', 'fs_game', 'training_mission'])

--
https://mail.python.org/mailman/listinfo/python-list


Re: [TKinter]How to set LabelFrames font and color from option file

2017-12-14 Thread Gene Heskett
On Thursday 14 December 2017 10:00:07 Beppe wrote:

> Il giorno giovedì 14 dicembre 2017 15:18:31 UTC+1, Peter Otten ha 
scritto:
> > Beppe wrote:
> > > I don't succeed in planning the value of the font and color in the
> > > LabelFrames using the option_db file, such as
> > >
> > > *LabelFrame*font: Helvetica 14
> > > *LabelFrame*foreground: red
> > >
> > > exist a list of the keywordses to use?
> > >
> > >>> import tkinter as tk
> > >>> root = tk.Tk()
> > >>> lf = tk.LabelFrame(root)
> > >>> lf["class"]
> >
> > 'Labelframe'
> >
> > Do you spot the difference? The class of the LabelFrame widget is
> > Labelframe with a lowercase f. Once you change your database entries
> > to
> >
> > *Labelframe*font: Helvetica 14
> > *Labelframe*foreground: red
> >
> > everything should work as expected.
>
> perfect, it works too much well, even my buttons now are helvetica 14
> and red  ;(
In that event, you can label the text buttons like this:
  
"checkbutton1"
"CamSW"
('Hack',12)
  
For a different font.

I'd assume ('green') might work, but haven't tried it since it 
cannot be changed with the halpin state. Then it would be useful to 
report status w/o having the put an led underline under it for state. 
That would save a considerable acreage in screen real estate if it were 
possible on an already busy linuxcnc gui. IMO the enforced blank space 
around text is also a huge waster of screen real estate.

You can find some tut's on doing all this in the linuxcnc 
Documentation.pdf, downloadable from linuxcnc.org, in my version 
starting on page 366. Under "pyvcp" If you know of others, plz advise.

Cheers, Gene Heskett
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [TKinter]How to set LabelFrames font and color from option file

2017-12-14 Thread Gene Heskett
On Thursday 14 December 2017 11:29:03 Beppe wrote:

> Il giorno giovedì 14 dicembre 2017 16:36:24 UTC+1, Peter Otten ha 
scritto:
> > Beppe wrote:
> > > Il giorno giovedì 14 dicembre 2017 15:18:31 UTC+1, Peter Otten ha 
scritto:
> > >> Beppe wrote:
> > >> > I don't succeed in planning the value of the font and color in
> > >> > the LabelFrames using the option_db file, such as
> > >> >
> > >> > *LabelFrame*font: Helvetica 14
> > >> > *LabelFrame*foreground: red
> > >> >
> > >> > exist a list of the keywordses to use?
> > >> >
> > >> >>> import tkinter as tk
> > >> >>> root = tk.Tk()
> > >> >>> lf = tk.LabelFrame(root)
> > >> >>> lf["class"]
> > >>
> > >> 'Labelframe'
> > >>
> > >> Do you spot the difference? The class of the LabelFrame widget is
> > >> Labelframe with a lowercase f. Once you change your database
> > >> entries to
> > >>
> > >> *Labelframe*font: Helvetica 14
> > >> *Labelframe*foreground: red
> > >>
> > >> everything should work as expected.
> > >
> > > perfect, it works too much well, even my buttons now are helvetica
> > > 14 and red  ;(
> >
> > I does what you tell it to do. Remove the second wildcard if you
> > only want to change the Labelframe style:
> >
> > *Labelframe.font: Helvetica 14
> > *Labelframe.foreground: red
>
> Does that mean buttons  inerith text from labelframe?!?! it looks so.

They do if you do not specify differently within the 

content

Cheers, Gene Heskett
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [TKinter]How to set LabelFrames font and color from option file

2017-12-14 Thread Beppe
Il giorno giovedì 14 dicembre 2017 19:28:53 UTC+1, Gene Heskett ha scritto:
> On Thursday 14 December 2017 10:00:07 Beppe wrote:
> 
> > Il giorno giovedì 14 dicembre 2017 15:18:31 UTC+1, Peter Otten ha 
> scritto:
> > > Beppe wrote:
> > > > I don't succeed in planning the value of the font and color in the
> > > > LabelFrames using the option_db file, such as
> > > >
> > > > *LabelFrame*font: Helvetica 14
> > > > *LabelFrame*foreground: red
> > > >
> > > > exist a list of the keywordses to use?
> > > >
> > > >>> import tkinter as tk
> > > >>> root = tk.Tk()
> > > >>> lf = tk.LabelFrame(root)
> > > >>> lf["class"]
> > >
> > > 'Labelframe'
> > >
> > > Do you spot the difference? The class of the LabelFrame widget is
> > > Labelframe with a lowercase f. Once you change your database entries
> > > to
> > >
> > > *Labelframe*font: Helvetica 14
> > > *Labelframe*foreground: red
> > >
> > > everything should work as expected.
> >
> > perfect, it works too much well, even my buttons now are helvetica 14
> > and red  ;(
> In that event, you can label the text buttons like this:
>   
> "checkbutton1"
> "CamSW"
> ('Hack',12)
>   
> For a different font.
> 
> I'd assume ('green') might work, but haven't tried it since it 
> cannot be changed with the halpin state. Then it would be useful to 
> report status w/o having the put an led underline under it for state. 
> That would save a considerable acreage in screen real estate if it were 
> possible on an already busy linuxcnc gui. IMO the enforced blank space 
> around text is also a huge waster of screen real estate.
> 
> You can find some tut's on doing all this in the linuxcnc 
> Documentation.pdf, downloadable from linuxcnc.org, in my version 
> starting on page 366. Under "pyvcp" If you know of others, plz advise.
> 
> Cheers, Gene Heskett
> -- 
> "There are four boxes to be used in defense of liberty:
>  soap, ballot, jury, and ammo. Please use in that order."
> -Ed Howdershelt (Author)
> Genes Web page 

linuxcnc.org ?!?! wow...very cool...
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: subprocess call question

2017-12-14 Thread Wanderer
That works. Thanks
-- 
https://mail.python.org/mailman/listinfo/python-list


Accessing Self Inside Decorator with parameters

2017-12-14 Thread Brian Herman
I would like to access the instance variable of a class using a decorator
with arguments:
I used to do with with a decorator without arguments:

def decorator(method):
""" This method is a decorator to get a security token each time you
have a service call. """
def wrapper(self, *args, **kw):
self.call_this()
result = method(self, *args, **kw)

return result
return wrapper

class test1:
def call_this(self):
print("this works")
@decorator
def preform_action(self):
print("test")

However when I add the arguments decorator I cannot access the self of the
object that calls the decorator.

def decorator_with_arguments(arg1, arg2):
def decorator(self, method):
""" This method is a decorator to get a security token each time
you have a service call. """
def wrapper(self, *args, **kw):
self.call_this()
result = method(self, *args, **kw)

return result
return wrapper

class test2:
def call_this(self):
print("this does not")
@decorator_with_arguments(1,2)
def preform_action(self):
print("test")

Is there any way to do this pythonically?
-- 


Thanks,
Brian Herman
kompile.org 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Accessing Self Inside Decorator with parameters

2017-12-14 Thread Chris Angelico
On Fri, Dec 15, 2017 at 6:44 AM, Brian Herman  wrote:
> However when I add the arguments decorator I cannot access the self of the
> object that calls the decorator.
>
> def decorator_with_arguments(arg1, arg2):
> def decorator(self, method):
> """ This method is a decorator to get a security token each time
> you have a service call. """
> def wrapper(self, *args, **kw):
> self.call_this()
> result = method(self, *args, **kw)
>
> return result
> return wrapper

Why does the decorator take a self parameter? The wrapper function
does, but when your decorator() runs, it's just looking at a function
and returning a function. Try removing self from that and see if it
solves your problem.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please tell me how to execute python file in Ubuntu by double

2017-12-14 Thread Gregory Ewing

Rhodri James wrote:
Even then there was RiscOS, which divorced file names from file types 
entirely.


As did classic MacOS.

I believe MacOSX also has the ability to store a file type
as metadata, but it doesn't seem to be used much.

--
Greg

--
https://mail.python.org/mailman/listinfo/python-list


Let your code type-hint itself: introducing open source MonkeyType

2017-12-14 Thread breamoreboy
Seeing that type hinting is one of the big new features of Python I thought 
folks might find this 
https://engineering.instagram.com/let-your-code-type-hint-itself-introducing-open-source-monkeytype-a855c7284881
 of interest.

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Why does Jupyter Notebook searches files in folders, but PyCharm and Sublime Text does not?

2017-12-14 Thread C W
Hi all,

I am confused why Jupyter Notebook searches files in subfolder, but PyCharm
and Sublime Text 3 does not. Is there a rule?

For example,
I have a module or file called lr_utils.py in the current folder.

If I run the following line in Jupyter, it's fine.
> import lr_utils

But in PyCharm, I get the error,
ModuleNotFoundError: No module named 'lr_utils'

If I run it in Sublime Text, it's find too
> import os
> os.chdir("Users/My_name/Desktop/Python_Codes")
> import lr_utils

Why the code works in one but not the other? Thank you!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: write your replace function in python

2017-12-14 Thread Steve D'Aprano
On Thu, 14 Dec 2017 09:08 pm, ayaskant.mantu...@gmail.com wrote:

> Hi,
> 
> I want to replace the spaces in a sting with hyphen with my own replace
> function or with using the pre-defined replace function. Can anybody help me
> with this issue???

new_string = "string with spaces".replace(" ", "hyphen")


When in doubt, open the Python interpreter to a command prompt ">>> " and
enter:

help("")

to see the string methods. Other commands work too:

help(str.replace)




-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

-- 
https://mail.python.org/mailman/listinfo/python-list