Hi all. Quick question (but aren't they all?) :)
Do you think it's a good idea to use the 'from <name> import *'
statement when using a GUI module? It seems on wxPython's site, they
recommend using import wx nowadays, but I wonder if that advice is
followed. Also, I'm still reading some Tkinter docs that seem to use
'from Tkinter import *' a lot.
I understand the danger of doing this, but is it safer in these cases,
given the more specific names that GUI frameworks tend to use
(sometimes!)? Or should you still qualify all your calls with the module? 8 1542
John Salerno wrote: Hi all. Quick question (but aren't they all?) :)
Do you think it's a good idea to use the 'from <name> import *' statement when using a GUI module? It seems on wxPython's site, they recommend using import wx nowadays, but I wonder if that advice is followed. Also, I'm still reading some Tkinter docs that seem to use 'from Tkinter import *' a lot.
I understand the danger of doing this, but is it safer in these cases, given the more specific names that GUI frameworks tend to use (sometimes!)? Or should you still qualify all your calls with the module?
The python style guide takes no position on this.
Personally I prefer explicit to implicit, and typing wx. is not really
that much to type is it?
"John Salerno" <jo******@NOSPA Mgmail.com> wrote in message
news:R2******** **********@news .tufts.edu... Hi all. Quick question (but aren't they all?) :)
Do you think it's a good idea to use the 'from <name> import *' statement when using a GUI module? It seems on wxPython's site, they recommend using import wx nowadays, but I wonder if that advice is followed. Also, I'm still reading some Tkinter docs that seem to use 'from Tkinter import *' a lot.
I understand the danger of doing this, but is it safer in these cases, given the more specific names that GUI frameworks tend to use (sometimes!)? Or should you still qualify all your calls with the module?
If I were to use Tkinter, I would 'import Tkinter as tk'. ak*********@gma il.com wrote: Personally I prefer explicit to implicit, and typing wx. is not really that much to type is it?
No, but typing "Tkinter." is! ;)
Le 31-05-2006, John <jo******@NOSPA Mgmail.com> nous disait: Hi all. Quick question (but aren't they all?) :)
Do you think it's a good idea to use the 'from <name> import *' statement when using a GUI module? It seems on wxPython's site, they recommend using import wx nowadays, but I wonder if that advice is followed. Also, I'm still reading some Tkinter docs that seem to use 'from Tkinter import *' a lot.
I understand the danger of doing this, but is it safer in these cases, given the more specific names that GUI frameworks tend to use (sometimes!)? Or should you still qualify all your calls with the module?
Don't overlook the "import module as shortname" construct, which is a
real lifesaver for large modules when you'd rather avoid importing *
Common idiom when using Numeric/numarray/numpy is
import Numeric as N
Importing Tkinter as tk is imo worth it.
--
Alexandre Fayolle LOGILAB, Paris (France)
Formations Python, Zope, Plone, Debian: http://www.logilab.fr/formations
Développement logiciel sur mesure: http://www.logilab.fr/services
Python et calcul scientifique: http://www.logilab.fr/science
Terry Reedy wrote: If I were to use Tkinter, I would 'import Tkinter as tk'.
Good idea!
I was kind of excited about Tkinter for a little while...seems very
easy, and it has an event delegation system that I understand! But then
I saw that for a toolbar you use a Frame? And for a status bar you use a
Label? Ick!
I guess if I'm going to learn a GUI, I might as well jump right into
wxPython from the beginning.
John Salerno wrote: Terry Reedy wrote:
If I were to use Tkinter, I would 'import Tkinter as tk'.
Good idea!
I was kind of excited about Tkinter for a little while...seems very easy, and it has an event delegation system that I understand! But then I saw that for a toolbar you use a Frame? And for a status bar you use a Label? Ick!
I guess if I'm going to learn a GUI, I might as well jump right into wxPython from the beginning.
Better first look at Qt/PyQt before jumping right into wxPython.
You will at least know what you will be jumping into.
John Salerno wrote: Hi all. Quick question (but aren't they all?) :)
Do you think it's a good idea to use the 'from <name> import *' statement when using a GUI module? It seems on wxPython's site, they recommend using import wx nowadays, but I wonder if that advice is followed. Also, I'm still reading some Tkinter docs that seem to use 'from Tkinter import *' a lot.
I understand the danger of doing this, but is it safer in these cases, given the more specific names that GUI frameworks tend to use (sometimes!)? Or should you still qualify all your calls with the module?
More specific? I dunno, I have trouble thinking of that
huge multitude of names in wx as specific. Who knows what
in all that might collide with names you devise?
My formative experience came when I was looking at Python
Imaging Library Demo code. Somebody did a simple call to
open and got returned an entire Jpeg image object. I knew
that open was destined to take arguments other than simple
file paths, and return things other than simple files, but
it seemed awfully soon. Then I got suspicious, looked at
the top of the code, and saw "from Image import *"
So a word, too, to people writing demo programs. Writing
"from mycode import *" obscures which code is actually yours
in the code following. Kind of defeats the purpose.
Cheers, Mel.
On 5/31/06, John Salerno <jo******@nospa mgmail.com> wrote: I guess if I'm going to learn a GUI, I might as well jump right into wxPython from the beginning.
May I recommend that you take a look at the Dabo project? While they
have a full application framework for creating database applications,
you can easily just use the dabo.ui module, which wraps wxPython. This
eliminates most of the C++ cruft that wxPython inherited from
wxWidgets, and makes for a much more Pythonic experience.
I worked with wxPython for a couple of years, and looked at Dabo based
on a recommendation on the wxPython list. Since then, I haven't
written a single app using raw wxPython; I use the dabo.ui module for
all my GUI applications. It gives you all the advantages of wxPython,
but it just works better.
--
# p.d. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Bgc |
last post by:
Hello All,
I've been struggling for years now trying to come up with a solution
to a very personal programming problem with Python. I'm an
educational programmer, and I make applications that are used in
educational environments by nontechnical folks. I therefore need GUIs
that are pretty, easy to use, and cross platform (win, mac, linux,
unix). In my search for a GUI, I've also come to the conclusion that
as much as I love Python,...
|
by: Carlos Ribeiro |
last post by:
Hello all,
I'm posting this to the list with the intention to form a group of
people interested in this type of solution. I'm not going to spam the
list with it, unless for occasional and relevant announcements. If
you're interested, drop me a note. But if for some reason you think
that this discussion is fine here at the c.l.py, please let me know.
** LONG POST AHEAD **
|
by: Bob Swerdlow |
last post by:
Anyone have opinions about whether we will be better off using PythonNet or
wxPython for the GUI layer of our application on Windows? Our code is all
Python and is now running on Mac OS X with PyObjC and Cocoa, which works
very well. Our goal is not necessarily to move to a cross-platform
solution, but rather to create a solid Windows version that looks and feels
like a native application. All the code that interacts with the user is...
|
by: Kenneth McDonald |
last post by:
If this is not an appropriate newsgroup for this type of posting,
please let me know and (if possible) suggest an alternative. I've
done a fair bit of research on the net, but information is scattered
all over the place and I haven't been able to find mailing lists
relating specifically to python and UIs.
I'd like to start using Python for some GUI programming again. I'd
like to use Tk, but it seems to be dying a slow death, so it's...
|
by: Bill |
last post by:
I want to create a GUI using VS .NET. For now I just want to input some
parameters used by the algorithms I've written in C++. Maybe later I want to
access a database to load the data from and plot figures if it isn't too
hard to do.
I haven't done any GUI's before so what should I use? Do you think I should
use the MFC library, or go with building a GUI using .NET, or something
else? If I use .NET then I need to write it using a...
| |
by: Paul Tremblay |
last post by:
Hi all,
First of all sorry for the cross post. I was not sure which ng would be
most appropriate.
I need a book that gives guidelines on good GUI design (preferably,
comes with a few template GUIs one can extend). There seems to be so
many books out there, I would be very grateful to hear from any
experienced GUI designer out there - who can recommend a book for
designing GUIs.
|
by: 63q2o4i02 |
last post by:
Hi, I'm interested in using python to start writing a CAD program for
electrical design. I just got done reading Steven Rubin's book, I've
used "real" EDA tools, and I have an MSEE, so I know what I *want* at
the end of this; I just have never taken on a programming task of this
magnitude. I've seen that some are using python as a utility language
for existing CAD environments, and I've also found some guy who's
writing a 2d drafting...
|
by: bagz |
last post by:
Hi im looking for a relatively easy and straight forward c gui to use,
but not sure which one to go for.
All i have to do is create a little area with a few input fields for
x,y,z start position of a ball.
Anyone have any suggestions as to which may be the best in my
situation?
Thanks in advance
|
by: compman9902 |
last post by:
Thank you for looking at my post.
Okay, first of all I would like to point out that I have been all over the internet and the library and I cannot seem to get it through my head on how to make GUIs in C++.
Here is what I need help with. All I need is a simple GUI window about 100 x 200 pixles. In it, I need to show a constantly changing intiger. What would be the best is if this window would open up when a function was called and the intiger...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |