[issue41969] ttk.RadioButtons mis-sized under Windows 10 UI Scaling, with dpiAware set true

2021-04-06 Thread Athanasius


Athanasius  added the comment:

I excitedy thought that you closing this issue meant that Python 3.9.3 or 3.9.4 
had the newer TCL and this fixed.

Sadly not.  I've just had GitHub build a fresh executable using Python 3.9.4 
(as evidenced by `Running on Python v3.9.4 (tags/v3.9.4:1f2e308, Apr  4 2021, 
13:14:17) [MSC v.1928 32 bit (Intel)]` in our logging) and this is still broken.

Out of a set of three radio buttons only the last is correctly scaled up when 
first viewed, the other two not being scaled up.  When I changed tab (a 
notebook) and back, even that third one is now not scaled up.

Any idea when Python will include a fixed TCL ?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43679] ttk.Sizegrip disappears under Windows 10 UI Scaling, with dpiAware set true and >1 scaling

2021-04-03 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

In issue 33656, we determined that tcl/tk *is* dpi aware and that telling 
Windows so is needed for proper text display.  IDLE now issues the same Windows 
command (idlelib.pyshell, line 20).  This perhaps should be done by Python 
itself, but that is not my department.  In any case, without the setting, text 
in IDLE Windows is much uglier on my 27 inch 2560 x 1440 screen.

IDLE Windows do not currently have sizegrips.  This seems to be standard on 
Windows. One can resize by grabbing the bottom of the lower right corner. But 
it is a bit finicky.

When I run your code, I see the small, faint, sizegrip.  Perhaps my screen is 
not HiDpi enough to see the problem.  In any case, this is a tcl/tk issue.  
Perhaps upgrading to 8.6.11 (#43652) will help, as it is supposed to for the 
radiobutton issue.

--
nosy: +serhiy.storchaka, terry.reedy
resolution:  -> third party
stage:  -> resolved
status: open -> closed
versions: +Python 3.10 -Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41969] ttk.RadioButtons mis-sized under Windows 10 UI Scaling, with dpiAware set true

2021-04-03 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
stage:  -> resolved
status: pending -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43694] Tkinter scaling does not work on some linux systems

2021-04-01 Thread A_D


A_D  added the comment:

Thanks so much for your help. To anyone in the future trying to figure this 
out: Apparently the default opensuse fonts (which are noto) are _not_ scalable. 
In my testing the following is enough to solve the issue.

```
tk.font.nametofont('TkDefaultFont').configure(family='DejaVu Sans', size=10)
```

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43694] Tkinter scaling does not work on some linux systems

2021-04-01 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

AFAIK X Window uses two font systems: for bitmap fonts and for scalable fonts. 
If default fonts on your system are bitmap fonts, they are not scaled.

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43694] Tkinter scaling does not work on some linux systems

2021-04-01 Thread A_D


A_D  added the comment:

Okay that makes sense to me. But then my next question is, why does this work 
on some linux systems and not others without having a specified font? 

Something funky about the font size? because I'd expect the platform defaults 
to at least be the same on different linux systems.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43694] Tkinter scaling does not work on some linux systems

2021-04-01 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The size of of the window is determined by the size of its components. The size 
of the label and the munu is determined by the size of the font. If font has 
the same size and you output the same string (or string containing characters 
of the same proportion) you will get windows with the same size.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43694] Tkinter scaling does not work on some linux systems

2021-04-01 Thread A_D


A_D  added the comment:

I'd expect the windows themselves to change size based on the percentage 
requested. eg as shown here 
https://user-images.githubusercontent.com/4589845/95577562-0a794500-0a3b-11eb-914e-9a5afc500b65.png
 (semirelated issue: https://github.com/EDCD/EDMarketConnector/issues/750 )

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43694] Tkinter scaling does not work on some linux systems

2021-04-01 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

What did you expect to get?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43694] Tkinter scaling does not work on some linux systems

2021-04-01 Thread A_D


A_D  added the comment:

I wasnt referring to fonts, I was refering to window scaling in general, which 
includes widgets and other things. Which are _also_ not being scaled correctly.

The example code doesnt mess with fonts at all either, which either means the 
default behaves in an unexpected manner, or just that as I said scaling just 
straight doesnt work.

--

___
Python tracker 
<https://bugs.python.org/issue43694>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43694] Tkinter scaling does not work on some linux systems

2021-04-01 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

>From "man font":

FONT OPTIONS

   -size size
  The desired size of the font.  If the size argument is  a  posi‐
  tive  number, it is interpreted as a size in points.  If size is
  a negative number, its absolute value is interpreted as  a  size
  in pixels.  If a font cannot be displayed at the specified size,
  a nearby size will be chosen.  If size is unspecified or zero, a
  platform-dependent default size will be chosen.

  Sizes  should normally be specified in points so the application
  will remain the same ruler size on the screen, even when  chang‐
  ing screen resolutions or moving scripts across platforms.  How‐
  ever, specifying pixels is useful in certain circumstances  such
  as  when  a  piece of text must line up with respect to a fixed-
  size bitmap.  The mapping between points and pixels is set  when
  the  application  starts,  based  on properties of the installed
  monitor, but it can be overridden by calling the tk scaling com‐
  mand.

If the font size is specified in absolute pixels the scaling factor does not 
affect it.

See fix_scaling() in Lib/idlelib/run.py for example how to handle this problem.

--
nosy: +serhiy.storchaka

___
Python tracker 
<https://bugs.python.org/issue43694>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43694] Tkinter scaling does not work on some linux systems

2021-04-01 Thread A_D


New submission from A_D :

When using scaling (as in root.tk.call('scaling', somenum)), some linux systems 
appear to simply disregard the change. 

I recently reinstalled from Ubuntu to OpenSUSE Tumbleweed and found that 
scaling straight up did not work in the application I tried or the test 
application -- https://github.com/Athanasius/tk-scaling. (image attached)

Tested on python 3.8.8 and 3.9.2 (pyenv)

--
components: Tkinter
files: Screenshot_20210401_132045.png
messages: 389975
nosy: aunderscored
priority: normal
severity: normal
status: open
title: Tkinter scaling does not work on some linux systems
type: behavior
versions: Python 3.7, Python 3.8, Python 3.9
Added file: https://bugs.python.org/file49924/Screenshot_20210401_132045.png

___
Python tracker 
<https://bugs.python.org/issue43694>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43679] ttk.Sizegrip disappears under Windows 10 UI Scaling, with dpiAware set true and >1 scaling

2021-03-31 Thread MikeS


New submission from MikeS :

When using tkinter on Windows (10) with a >1 HiDpi screen the sizegrip 
disappear with dpiawareness is on. A minimal example is as follows:

import tkinter as tk
import tkinter.ttk as ttk
from ctypes import windll, pointer, wintypes
windll.shcore.SetProcessDpiAwareness(1)

root = tk.Tk()
btn1 = tk.Button(root, text='btn1').pack(side=tk.LEFT)
sg = ttk.Sizegrip(root).pack(side=tk.LEFT)
btn2 = tk.Button(root, text='btn2').pack(side=tk.LEFT, fill=tk.BOTH, expand=1)
root.mainloop()

Works fine with commented "SetProcessDpiAwareness", but not when using it. This 
might be related to the tk issues with hidpi and small radio/checkboxes 
https://bugs.python.org/issue41969

--
components: Tkinter
messages: 389893
nosy: msmith
priority: normal
severity: normal
status: open
title: ttk.Sizegrip disappears under Windows 10 UI Scaling, with dpiAware set 
true and >1 scaling
type: behavior
versions: Python 3.7

___
Python tracker 
<https://bugs.python.org/issue43679>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41969] ttk.RadioButtons mis-sized under Windows 10 UI Scaling, with dpiAware set true

2020-12-15 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> third party
status: open -> pending

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41969] ttk.RadioButtons mis-sized under Windows 10 UI Scaling, with dpiAware set true

2020-10-07 Thread Athanasius


New submission from Athanasius :

Having recently looked into UI Scaling for an application I help develop I 
became aware with an issue involving tkinter.ttk.RadioButton and Windows UI 
Scaling.

When you have some UI Scaling set along with dpiAware set true you might find 
that radio buttons are mis-rendered. The usual manifestation of this is that 
the last button will be properly sized initially, with the others being 
undersized. If you even only mouse-over the 'correct' radio button it will then 
become undersized as well.

For more detail see: https://github.com/Athanasius/tk-radio-buttons

NB: This *has* been fixed upstream in the Tcl/Tk source, but I see they've not 
made a new release since 8.6.10 in November 2019.  Thus this issue is more in 
the way of a heads up about a bug others might encounter, and will have to wait 
for newer Tcl/Tk in some version of Python for it to be fixed.

See https://core.tcl-lang.org/tk/info/3c6660b6f0bed337 for the issue and fix.

--
components: Tkinter
messages: 378171
nosy: Athanasius
priority: normal
severity: normal
status: open
title: ttk.RadioButtons mis-sized under Windows 10 UI Scaling, with dpiAware 
set true
type: behavior
versions: Python 3.9

___
Python tracker 
<https://bugs.python.org/issue41969>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



image scaling in cairo, python

2008-05-24 Thread _wolf
[also posted to: [EMAIL PROTECTED]

hi all,

i've heard cairo has become the image scling library for firefox3. is
that true? wonderful, i want to do that in python. there's a python
interface for cairo, right? i've used it before to do simple vector
stuff. seems to work. however, i haven't been able to find relevant
pointers via google.

so do you have any pointers on how to resize a raster image with
python using cairo? i've been jumping through hoops for a while now,
and i believe it should be easier.

cheers and ~flow

ps. related (long) posts:

http://groups.google.com/group/pyglet-users/browse_frm/thread/44253ad01d809da5/cd051e6bced271e1#cd051e6bced271e1

http://groups.google.com/group/comp.lang.python/browse_frm/thread/5df65d99cff0d7bb#
--
http://mail.python.org/mailman/listinfo/python-list


Re: scaling problems

2008-05-20 Thread Arnaud Delobelle
James A. Donald [EMAIL PROTECTED] writes:

 Ben Finney 

 The larger the program, the greater the likelihood of inadvertent name
 collisions creating rare and irreproducible interactions between
 different and supposedly independent parts of the program that each
 work fine on their own, and supposedly cannot possibly interact.

 These errors are a small subset of possible errors. If writing a large
 program, an automated testing suite is essential, and can catch far
 more errors than the compiler can hope to catch. If you run a static
 code analyser, you'll be notified of unused names and other simple
 errors that are often caught by static-declaration compilers.

 That is handy, but the larger the program, the bigger the problem with
 names that are over used, rather than unused.

Fortunately for each file that you group functionality in (called a
'module'), Python creates a brand new namespace where it puts all the
names defined in that file.  That makes name collision unlikely,
provided that you don't write gigantic modules with plenty of globals
in them (which would be very unnatural in Python), and don't use from
mymodule import * too liberally.

Why not download a largish project in Python (a web framework for
instance, since you have a particular interest in this), study the
code and see if your concerns seem founded?

Arnaud

 --
   --
 We have the right to defend ourselves and our property, because 
 of the kind of animals that we are. True law derives from this 
 right, not from the arbitrary power of the omnipotent state.

-- 
La propriete, c'est le vol !
   - Pierre-Joseph Proudhon
--
http://mail.python.org/mailman/listinfo/python-list


Re: scaling problems

2008-05-20 Thread Marc 'BlackJack' Rintsch
On Tue, 20 May 2008 13:57:26 +1000, James A. Donald wrote:

 The larger the program, the greater the likelihood of inadvertent name
 collisions creating rare and irreproducible interactions between
 different and supposedly independent parts of the program that each
 work fine on their own, and supposedly cannot possibly interact.

How should such collisions happen?  You don't throw all your names into
the same namespace!?

Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list


Re: scaling problems

2008-05-20 Thread Marc 'BlackJack' Rintsch
On Tue, 20 May 2008 10:47:50 +1000, James A. Donald wrote:

 2.  It is not clear to me how a python web application scales.

Ask YouTube.  :-)

Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list


Re: scaling problems

2008-05-20 Thread Graham Dumpleton
On May 20, 2:00 pm, James A. Donald [EMAIL PROTECTED] wrote:
   2.  It is not clear to me how a python web application scales.  Python
   is inherently single threaded, so one will need lots of python
   processes on lots of computers, with the database software handling
   parallel accesses to the same or related data.  One could organize it
   as one python program for each url, and one python process for each
   http request, but that involves a lot of overhead starting up and
   shutting down python processes.  Or one could organize it as one
   python program for each url, but if one gets a lot of http requests
   for one url, a small number of python processes will each sequentially
   handle a large number of those requests.  What I am really asking is:
   Are there python web frameworks that scale with hardware and how do
   they handle scaling?

 Reid Priedhorsky

  This sounds like a good match for Apache withmod_python.

 I would hope that it is, but the question that I would like to know is
 how does mod_python handle the problem - how do python programs and
 processes relate to web pages and http requests when one is using mod_python, 
 and what happens when one has quite a lot of web pages and
 a very large number of http requests?

Read:

  http://blog.dscpl.com.au/2007/09/parallel-python-discussion-and-modwsgi.html
  http://code.google.com/p/modwsgi/wiki/ProcessesAndThreading

They talk about multi process nature of Apache and how GIL is not as
big a deal when using it.

The latter document explains the various process/threading modes when
using Apache/mod_wsgi. The embedded modes described in that
documentation also apply to mod_python.

The server is generally never the bottleneck, but if you are paranoid
about performance, then also look at relative comparison of mod_wsgi
and mod_python in:

  http://code.google.com/p/modwsgi/wiki/PerformanceEstimates

Graham

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


Re: scaling problems

2008-05-20 Thread Nick Craig-Wood
Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote:
  On Tue, 20 May 2008 13:57:26 +1000, James A. Donald wrote:
 
  The larger the program, the greater the likelihood of inadvertent name
  collisions creating rare and irreproducible interactions between
  different and supposedly independent parts of the program that each
  work fine on their own, and supposedly cannot possibly interact.
 
  How should such collisions happen?  You don't throw all your names into
  the same namespace!?

If you ever did a lot of programming in C with large projects you have
exactly that problem a lot - there is only one namespace for all the
external functions and variables, and macro definitions from one
include are forever messing up those from another.  I suspect the OP
is coming from that background.

However python doesn't have that problem at all due to its use of
module namespaces - each name is confined to within a module (file)
unless you take specific action otherwise, and each class attribute is
confined to the class etc.

From the Zen of Python Namespaces are one honking great idea -- let's
do more of those! - as a battle scarred C programmer I'd agree ;-)

-- 
Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list


Re: scaling problems

2008-05-20 Thread Duncan Booth
Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote:

 On Tue, 20 May 2008 10:47:50 +1000, James A. Donald wrote:
 
 2.  It is not clear to me how a python web application scales.
 
 Ask YouTube.  :-)

Or look at Google appengine where unlike normal Python you really are 
prevented from making good use of threading.

Google App Engine takes an interesting approach by forcing the programmer 
to consider scalability right from the start: state is stored in a 
distributed database which cannot do all the hard to scale things that SQL 
databases do. This means that you have to work as though your application 
were spread on servers all round the world from day 1 instead of waiting 
until the structure that was 'good enough' is threatening to kill your 
business before you address them.

It also puts strict limits on how much a single web request can do, so 
again you have to work from day 1 to make sure that page requests are as 
efficient as possible.

In return you get an application which should scale well. There is nothing 
Python specific about the techniques, it is just that Python is the first 
(and so far only) language supported on the platform.

-- 
Duncan Booth http://kupuguy.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: scaling problems

2008-05-20 Thread David Stanek
On Tue, May 20, 2008 at 12:03 AM, James A. Donald [EMAIL PROTECTED] wrote:
 On Mon, 19 May 2008 21:04:28 -0400, David Stanek
 [EMAIL PROTECTED] wrote:
 What is the difference if you have a process with 10 threads or 10
 separate processes running in parallel? Apache is a good example of a
 server that may be configured to use multiple processes to handle
 requests. And from what I hear is scales just fine.

 I think you are looking at the problem wrong. The fundamentals are the
 same between threads and processes.

 I am not planning to write a web server framework, but to use one.
 Doubtless a python framework could be written to have satisfactory
 scaling properties, but what are the scaling properties of the ones
 that have been written?


Both Django and TurborGears work well for me. When you step back and
think about it all of the popular web frameworks would do just fine.
The ones that don't do multiprocessing out of the box would be trivial
to load balance behind Apache or a real load balancer. Again the
problem here is the number of connections to the database, once you
get big enough to worry about it.

-- 
David
http://www.traceback.org
--
http://mail.python.org/mailman/listinfo/python-list


scaling problems

2008-05-19 Thread James A. Donald
I am just getting into python, and know little about it, and am
posting to ask on what beaches the salt water crocodiles hang out.

1.  Looks to me that python will not scale to very large programs,
partly because of the lack of static typing, but mostly because there
is no distinction between creating a new variable and utilizing an
existing variable, so the interpreter fails to catch typos and name
collisions.  I am inclined to suspect that when a successful small
python program turns into a large python program, it rapidly reaches
ninety percent complete, and remains ninety percent complete forever.

2.  It is not clear to me how a python web application scales.  Python
is inherently single threaded, so one will need lots of python
processes on lots of computers, with the database software handling
parallel accesses to the same or related data.  One could organize it
as one python program for each url, and one python process for each
http request, but that involves a lot of overhead starting up and
shutting down python processes.  Or one could organize it as one
python program for each url, but if one gets a lot of http requests
for one url, a small number of python processes will each sequentially
handle a large number of those requests.  What I am really asking is:
Are there python web frameworks that scale with hardware and how do
they handle scaling?

Please don't read this as Python sucks, everyone should program in
machine language expressed as binary numbers.  I am just asking where
the problems are.
--
  --
We have the right to defend ourselves and our property, because 
of the kind of animals that we are. True law derives from this 
right, not from the arbitrary power of the omnipotent state.

http://www.jim.com/  James A. Donald
--
http://mail.python.org/mailman/listinfo/python-list


Re: scaling problems

2008-05-19 Thread Reid Priedhorsky
On Tue, 20 May 2008 10:47:50 +1000, James A. Donald wrote:

 1.  Looks to me that python will not scale to very large programs,
 partly because of the lack of static typing, but mostly because there
 is no distinction between creating a new variable and utilizing an
 existing variable, so the interpreter fails to catch typos and name
 collisions.  I am inclined to suspect that when a successful small
 python program turns into a large python program, it rapidly reaches
 ninety percent complete, and remains ninety percent complete forever.

I find this frustrating too, but not to the extent that I choose a
different language. pylint helps but it's not as good as a nice, strict
compiler.

 2.  It is not clear to me how a python web application scales.  Python
 is inherently single threaded, so one will need lots of python
 processes on lots of computers, with the database software handling
 parallel accesses to the same or related data.  One could organize it
 as one python program for each url, and one python process for each
 http request, but that involves a lot of overhead starting up and
 shutting down python processes.  Or one could organize it as one
 python program for each url, but if one gets a lot of http requests
 for one url, a small number of python processes will each sequentially
 handle a large number of those requests.  What I am really asking is:
 Are there python web frameworks that scale with hardware and how do
 they handle scaling?

This sounds like a good match for Apache with mod_python.

Reid
--
http://mail.python.org/mailman/listinfo/python-list


Re: scaling problems

2008-05-19 Thread David Stanek
On Mon, May 19, 2008 at 8:47 PM, James A. Donald [EMAIL PROTECTED] wrote:
 I am just getting into python, and know little about it, and am
 posting to ask on what beaches the salt water crocodiles hang out.

 1.  Looks to me that python will not scale to very large programs,
 partly because of the lack of static typing, but mostly because there
 is no distinction between creating a new variable and utilizing an
 existing variable, so the interpreter fails to catch typos and name
 collisions.  I am inclined to suspect that when a successful small
 python program turns into a large python program, it rapidly reaches
 ninety percent complete, and remains ninety percent complete forever.

I can assure you that in practice this is not a problem. If you do
proper unit testing then you will catch many, if not all, of the
errors that static typing catches. There are also tools like PyLint,
PyFlakes and pep8.py will also catch many of those mistakes.


 2.  It is not clear to me how a python web application scales.  Python
 is inherently single threaded, so one will need lots of python
 processes on lots of computers, with the database software handling
 parallel accesses to the same or related data.  One could organize it
 as one python program for each url, and one python process for each
 http request, but that involves a lot of overhead starting up and
 shutting down python processes.  Or one could organize it as one
 python program for each url, but if one gets a lot of http requests
 for one url, a small number of python processes will each sequentially
 handle a large number of those requests.  What I am really asking is:
 Are there python web frameworks that scale with hardware and how do
 they handle scaling?

What is the difference if you have a process with 10 threads or 10
separate processes running in parallel? Apache is a good example of a
server that may be configured to use multiple processes to handle
requests. And from what I hear is scales just fine.

I think you are looking at the problem wrong. The fundamentals are the
same between threads and processes. You simply have a pool of workers
that handle requests. Any process is capable of handling any request.
The key to scalability is that the processes are persistent and not
forked for each request.


 Please don't read this as Python sucks, everyone should program in
 machine language expressed as binary numbers.  I am just asking where
 the problems are.

The only real problem I have had with process pools is that sharing
resources is harder. It is harder to create things like connection
pools.


-- 
David
http://www.traceback.org
--
http://mail.python.org/mailman/listinfo/python-list


Re: scaling problems

2008-05-19 Thread Ben Finney
James A. Donald [EMAIL PROTECTED] writes:

 I am just getting into python, and know little about it

Welcome to Python, and this forum.

 and am posting to ask on what beaches the salt water crocodiles hang
 out.

Heh. You want to avoid them, or hang out with them? :-)

 1.  Looks to me that python will not scale to very large programs,
 partly because of the lack of static typing, but mostly because there
 is no distinction between creating a new variable and utilizing an
 existing variable,

This seems quite a non sequitur. How do you see a connection between
these properties and will not scale to large programs?

 so the interpreter fails to catch typos and name collisions.

These errors are a small subset of possible errors. If writing a large
program, an automated testing suite is essential, and can catch far
more errors than the compiler can hope to catch. If you run a static
code analyser, you'll be notified of unused names and other simple
errors that are often caught by static-declaration compilers.

 I am inclined to suspect that when a successful small python program
 turns into a large python program, it rapidly reaches ninety percent
 complete, and remains ninety percent complete forever.

You may want to look at the Python success stories before suspecting
that, URL:http://www.python.org/about/success/.

 2.  It is not clear to me how a python web application scales.

I'll leave this one for others to speak to; I don't have experience
with large web applications.

-- 
 \ I was gratified to be able to answer promptly and I did. I |
  `\said I didn't know.  -- Mark Twain, _Life on the Mississippi_ |
_o__)  |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list


Re: scaling problems

2008-05-19 Thread Carl Banks
On May 19, 8:47 pm, James A. Donald [EMAIL PROTECTED] wrote:
 1.  Looks to me that python will not scale to very large programs,
 partly because of the lack of static typing, but mostly because there
 is no distinction between creating a new variable and utilizing an
 existing variable, so the interpreter fails to catch typos and name
 collisions.

This factor is scale-neutral.  You can expect the number of such bugs
to be proportional to the lines of code.

It might not scale up well if you engage in poor programming practives
(for example, importing lots of unqualified globals with tiny,
undescriptive names directly into every module's namespace), but if
you do that you have worse problems than accidental name collisions.


 I am inclined to suspect that when a successful small
 python program turns into a large python program, it rapidly reaches
 ninety percent complete, and remains ninety percent complete forever.

Unlike most C++/Java/VB/Whatever programs which finish and ship, and
are never patched or improved or worked on ever again?


 2.  It is not clear to me how a python web application scales.  Python
 is inherently single threaded,

No it isn't.

It has some limitations in threading, but many programs make good use
of threads nonetheless.  In fact for something like a web app Python's
threading limitations are relatively unimportant, since they tend to
be I/O-bound under heavy load.

[snip rest]


Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list


Re: scaling problems

2008-05-19 Thread James A. Donald
  1.  Looks to me that python will not scale to very large programs,
  partly because of the lack of static typing, but mostly because there
  is no distinction between creating a new variable and utilizing an
  existing variable,

Ben Finney 
 This seems quite a non sequitur. How do you see a connection between
 these properties and will not scale to large programs?

The larger the program, the greater the likelihood of inadvertent name
collisions creating rare and irreproducible interactions between
different and supposedly independent parts of the program that each
work fine on their own, and supposedly cannot possibly interact.

 These errors are a small subset of possible errors. If writing a large
 program, an automated testing suite is essential, and can catch far
 more errors than the compiler can hope to catch. If you run a static
 code analyser, you'll be notified of unused names and other simple
 errors that are often caught by static-declaration compilers.

That is handy, but the larger the program, the bigger the problem with
names that are over used, rather than unused.

--
  --
We have the right to defend ourselves and our property, because 
of the kind of animals that we are. True law derives from this 
right, not from the arbitrary power of the omnipotent state.

http://www.jim.com/  James A. Donald
--
http://mail.python.org/mailman/listinfo/python-list


Re: scaling problems

2008-05-19 Thread James A. Donald
  2.  It is not clear to me how a python web application scales.  Python
  is inherently single threaded, so one will need lots of python
  processes on lots of computers, with the database software handling
  parallel accesses to the same or related data.  One could organize it
  as one python program for each url, and one python process for each
  http request, but that involves a lot of overhead starting up and
  shutting down python processes.  Or one could organize it as one
  python program for each url, but if one gets a lot of http requests
  for one url, a small number of python processes will each sequentially
  handle a large number of those requests.  What I am really asking is:
  Are there python web frameworks that scale with hardware and how do
  they handle scaling?

Reid Priedhorsky 
 This sounds like a good match for Apache with mod_python.

I would hope that it is, but the question that I would like to know is
how does mod_python handle the problem - how do python programs and
processes relate to web pages and http requests when one is using
mod_python, and what happens when one has quite a lot of web pages and
a very large number of http requests?
--
  --
We have the right to defend ourselves and our property, because 
of the kind of animals that we are. True law derives from this 
right, not from the arbitrary power of the omnipotent state.

http://www.jim.com/  James A. Donald
--
http://mail.python.org/mailman/listinfo/python-list


Re: scaling problems

2008-05-19 Thread James A. Donald
On Mon, 19 May 2008 21:04:28 -0400, David Stanek
[EMAIL PROTECTED] wrote:
 What is the difference if you have a process with 10 threads or 10
 separate processes running in parallel? Apache is a good example of a
 server that may be configured to use multiple processes to handle
 requests. And from what I hear is scales just fine.
 
 I think you are looking at the problem wrong. The fundamentals are the
 same between threads and processes.

I am not planning to write a web server framework, but to use one.
Doubtless a python framework could be written to have satisfactory
scaling properties, but what are the scaling properties of the ones
that have been written?

--
  --
We have the right to defend ourselves and our property, because 
of the kind of animals that we are. True law derives from this 
right, not from the arbitrary power of the omnipotent state.

http://www.jim.com/  James A. Donald
--
http://mail.python.org/mailman/listinfo/python-list


Re: the scaling of pics in pygame

2008-04-02 Thread Ramsey Nasser
Isn't PIL best suited for things like this?

The resize function should do what you're looking for:
http://www.pythonware.com/library/pil/handbook/image.htm

On Wed, Apr 2, 2008 at 6:59 AM,  [EMAIL PROTECTED] wrote:
 On Apr 1, 9:44 pm, Jimmy [EMAIL PROTECTED] wrote:
   Hi, everyone
  
   I am using Pygame to write a small program. I tried to load a .jpg
   picture into
   the screen, however, the size of the pic doesn't fit into the window
   properly. Can
   anyone tell me how to scale the picture into the window?

  You might get a quicker answer at pygame.org - check the mailing list
  and/or docs.



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




-- 
nasser
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: the scaling of pics in pygame

2008-04-02 Thread alex23
On Apr 2, 12:44 pm, Jimmy [EMAIL PROTECTED] wrote:
 I am using Pygame to write a small program. I tried to load a .jpg
 picture into
 the screen, however, the size of the pic doesn't fit into the window
 properly. Can
 anyone tell me how to scale the picture into the window?

Have you tried the Pygame documentation?

http://www.pygame.org/docs/ref/transform.html#pygame.transform.scale

- alex23

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


the scaling of pics in pygame

2008-04-01 Thread Jimmy
Hi, everyone

I am using Pygame to write a small program. I tried to load a .jpg
picture into
the screen, however, the size of the pic doesn't fit into the window
properly. Can
anyone tell me how to scale the picture into the window?

thanks!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: the scaling of pics in pygame

2008-04-01 Thread lbonafide
On Apr 1, 9:44 pm, Jimmy [EMAIL PROTECTED] wrote:
 Hi, everyone

 I am using Pygame to write a small program. I tried to load a .jpg
 picture into
 the screen, however, the size of the pic doesn't fit into the window
 properly. Can
 anyone tell me how to scale the picture into the window?

You might get a quicker answer at pygame.org - check the mailing list
and/or docs.

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


scaling

2007-05-01 Thread Ashok
hi,
IDL language contains a function called BYTSCL to scale all values of
Array that lie in the range (Min £ x £ Max) into the range (0 £ x £
Top). Is there a similar function available in python?

I need this to scale the pixel values of an image using PIL.

thanks in advance for any help

AGK

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


Re: scaling

2007-05-01 Thread Gabriel Genellina
En Tue, 01 May 2007 11:22:28 -0300, Ashok [EMAIL PROTECTED] escribió:

 IDL language contains a function called BYTSCL to scale all values of
 Array that lie in the range (Min £ x £ Max) into the range (0 £ x £
 Top). Is there a similar function available in python?

 I need this to scale the pixel values of an image using PIL.

Maybe PIL contains something built in, but if all else fails, you could  
write it in Python:

def bytsclGen(data, minvalue=None, maxvalue=None, top=255):
   if minvalue is None: minvalue = min(data)
   if maxvalue is None: maxvalue = max(data)
   for x in data:
 if xminvalue: yield 0
 elif xmaxvalue: yield top
 else: yield (x-minvalue)*top/(maxvalue-minvalue)

def bytscl(data, minvalue=None, maxvalue=None, top=255):
   return list(bytsclGen(data, minvalue, maxvalue, top))

-- 
Gabriel Genellina
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: scaling

2007-05-01 Thread Charles Sanders
Gabriel Genellina wrote:
[snip]
 if xminvalue: yield 0
 elif xmaxvalue: yield top
 else: yield (x-minvalue)*top/(maxvalue-minvalue)
[snip]

Personally, I find

yield min(top,max(0,(x-minvalue)*top/(maxvalue-minvalue)))
or
scaled_value = (x-minvalue)*top/(maxvalue-minvalue)
yield min(top,max(0,scaled_value))

clearer, but I am aware that others disagree with this.


Charles
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Scaling pictures

2006-12-30 Thread cyberco
cyberco wrote:
 PIL is certainly a fine option, but I noticed that the scaled images
 (scaled with the ANTIALIAS filter) are not as good as you can get with,
 say, Photoshop. Maybe I'm just expecting too much, but I wish I could
 choose a higher quality rescaling algorithm. PIL still rocks though.

Sorry, I should have checked the facts a little better: you can set the
quality of the compression when saving:


img = Image.open('old.jpg')
img.thumbnail((640,480), Image.ANTIALIAS)
img.save('new.jpg', quality=95)


Now PIL is definitely the way to go. :)

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


Re: Scaling pictures

2006-12-29 Thread Kajsa Anka
On Thu, 28 Dec 2006 11:53:41 +0100, Kajsa Anka wrote
(in article [EMAIL PROTECTED]):

Thanks for the answers, I'll use PIL.

  jem

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


Re: Scaling pictures

2006-12-29 Thread cyberco
PIL is certainly a fine option, but I noticed that the scaled images
(scaled with the ANTIALIAS filter) are not as good as you can get with,
say, Photoshop. Maybe I'm just expecting too much, but I wish I could
choose a higher quality rescaling algorithm. PIL still rocks though.

On Dec 28, 2:32 pm, Ravi Teja [EMAIL PROTECTED] wrote:
 Kajsa Anka wrote:
  I would like some advice, I'm going to build a small app that will, among
  other things, scale images so that they can be published on a web site. I've
  never done any image processing in python before so I would like to ask what
  is the best way of doing this, I will not do anything else than scaling the
  images.

  I found the Python Imaging Library but before I dive into that I would like
  to know if there is a better way of doing this.Yes. Python Imaging Library 
  (PIL) is the preferred Python way to do
 this. The example is right in the 
 documentation.http://www.pythonware.com/library/pil/handbook/image.htm

 from PIL import Image
 import glob, os

 size = 128, 128

 for infile in glob.glob(*.jpg):
 file, ext = os.path.splitext(infile)
 im = Image.open(infile)
 im.thumbnail(size, Image.ANTIALIAS)
 im.save(file + .thumbnail, JPEG)

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


Scaling pictures

2006-12-28 Thread Kajsa Anka
I would like some advice, I'm going to build a small app that will, among 
other things, scale images so that they can be published on a web site. I've 
never done any image processing in python before so I would like to ask what 
is the best way of doing this, I will not do anything else than scaling the 
images.

I found the Python Imaging Library but before I dive into that I would like 
to know if there is a better way of doing this.

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


Re: Scaling pictures

2006-12-28 Thread buffi
Kajsa Anka wrote:
 I would like some advice, I'm going to build a small app that will, among
 other things, scale images so that they can be published on a web site. I've
 never done any image processing in python before so I would like to ask what
 is the best way of doing this, I will not do anything else than scaling the
 images.

 I found the Python Imaging Library but before I dive into that I would like
 to know if there is a better way of doing this.

I prefer using imagemagick whenever I have to do anything related to
images.
http://www.imagemagick.org/script/index.php

Resizing an image would be something like this

import os

filename = picture.png
outputfile = picture_resized.png
new_size = 100x100
os.system(convert %s -resize %s %s % (filename, new_size, outputfile))

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


Re: Scaling pictures

2006-12-28 Thread Ravi Teja

Kajsa Anka wrote:
 I would like some advice, I'm going to build a small app that will, among
 other things, scale images so that they can be published on a web site. I've
 never done any image processing in python before so I would like to ask what
 is the best way of doing this, I will not do anything else than scaling the
 images.

 I found the Python Imaging Library but before I dive into that I would like
 to know if there is a better way of doing this.

Yes. Python Imaging Library (PIL) is the preferred Python way to do
this. The example is right in the documentation.
http://www.pythonware.com/library/pil/handbook/image.htm

from PIL import Image
import glob, os

size = 128, 128

for infile in glob.glob(*.jpg):
file, ext = os.path.splitext(infile)
im = Image.open(infile)
im.thumbnail(size, Image.ANTIALIAS)
im.save(file + .thumbnail, JPEG)

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


Re: Scaling pictures

2006-12-28 Thread bearophileHUGS
Kajsa Anka:
 I found the Python Imaging Library but before I dive into that I would like
 to know if there is a better way of doing this.

PIL is very fit for that. Note that it creates thumbnails already by
itself, you can use that for bigger images too.

Bye,
bearophile

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


Scaling down (was Re: Dealing with marketing types...)

2005-06-12 Thread Aahz
In article [EMAIL PROTECTED],
Paul Rubin  http://[EMAIL PROTECTED] wrote:

What example?  Slashdot?  It uses way more hardware than it needs to,
at least ten servers and I think a lot more.  If LJ is using 6x as
many servers and taking 20x (?) as much traffic as Slashdot, then LJ
is doing something more efficiently than Slashdot.  

So what?  I think you're missing the real point of the article: using
LAMP scales *DOWN* in a way that enterprise systems don't.  Getting your
first prototype up and running is far more important than sheer
scalability, and LAMP does have many mechanisms to obtain scalability
when it's needed.
-- 
Aahz ([EMAIL PROTECTED])   * http://www.pythoncraft.com/

f u cn rd ths, u cn gt a gd jb n nx prgrmmng.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Scaling down (was Re: Dealing with marketing types...)

2005-06-12 Thread Paul Rubin
[EMAIL PROTECTED] (Aahz) writes:
 So what?  I think you're missing the real point of the article: using
 LAMP scales *DOWN* in a way that enterprise systems don't.  Getting your
 first prototype up and running is far more important than sheer
 scalability,

There comes a day when your first prototype can no longer handle the
traffic.  The question then is how do you deal with that.

 and LAMP does have many mechanisms to obtain scalability when it's
 needed.

LAMP seems to have no solution other than scaling (i.e. blowing more
money on hardware and colo space).  One really gets the impression
that a more thoughtful design could handle the traffic without needing
to scale the hardware.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Scaling down (was Re: Dealing with marketing types...)

2005-06-12 Thread Aahz
In article [EMAIL PROTECTED],
Paul Rubin  http://[EMAIL PROTECTED] wrote:
[EMAIL PROTECTED] (Aahz) writes:

 So what?  I think you're missing the real point of the article: using
 LAMP scales *DOWN* in a way that enterprise systems don't.  Getting your
 first prototype up and running is far more important than sheer
 scalability,

There comes a day when your first prototype can no longer handle the
traffic.  The question then is how do you deal with that.

Then you scale with hardware or do profiling and rewrite chunks,
whichever costs less FOR THE BUSINESS.

 and LAMP does have many mechanisms to obtain scalability when it's
 needed.

LAMP seems to have no solution other than scaling (i.e. blowing more
money on hardware and colo space).  One really gets the impression
that a more thoughtful design could handle the traffic without needing
to scale the hardware.

Is there some reason you keep repeating yourself without actually paying
attention to other people?
-- 
Aahz ([EMAIL PROTECTED])   * http://www.pythoncraft.com/

f u cn rd ths, u cn gt a gd jb n nx prgrmmng.
-- 
http://mail.python.org/mailman/listinfo/python-list