LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-31-2016, 02:25 PM   #1
SaintDanBert
Senior Member
 
Registered: Jan 2009
Location: "North Shore" Louisiana USA
Distribution: Mint-20.1 with Cinnamon
Posts: 1,720
Blog Entries: 3

Rep: Reputation: 107Reputation: 107
Linux Mint setup for Python-based development


I'm starting a development project in Python and need advice, help, prayers, for getting my workstation software all setup. It's just me so I'm not interested in anything "cloud" except as my backup hub.

I've succeeded in getting a tiny app to run using both TKinter and wxPython for GUI. (Actually, the wxPython edition has some glitch I haven't resolved yet.) My fingers know Emacs (pause for laughter to end...).

Some initial concerns include:
  • My brain knows CVS. Do folks still use that for one-man projects?
    If not, what should I be doing?
  • programming for multiple editions of Python
    (my workstation has v2.6, 2.7, 3.0, and 3.4...python --version reports v2.7.6)
  • list of additional packages and modules that I really want to use
    (other than what is built-in or ships with Python editions)
  • is there value in switch to another IDE? If so, which?
    (please don't make this an flame war about editors and IDEs)
  • what else have I forgotten to think about?

My workstations run Linux Mint 17.3 with Cinnamon or KDE desktops.
I also run an Ubuntu Server as my in-house mothership.

I've been a code slinger since the 70's with a Masters in Computer Science. The last part of my career was Project Manager "suit". I'm blowing the dust off my developer skills. Other than that, I'm retired.

Thanks in advance,
~~~ 0;-Dan

PS/ I'll summarize what I learn here and post it for LQ and others. 0;-D

Last edited by SaintDanBert; 05-31-2016 at 02:28 PM.
 
Old 05-31-2016, 03:19 PM   #2
SaintDanBert
Senior Member
 
Registered: Jan 2009
Location: "North Shore" Louisiana USA
Distribution: Mint-20.1 with Cinnamon
Posts: 1,720

Original Poster
Blog Entries: 3

Rep: Reputation: 107Reputation: 107
seeking Python GUI programming help

Folks,
I'm working to learn Python programming that includes a GUI. I found a web site, Building a Basic GUI with Python and built the wxPython edition. Can someone help with a runtime problem?

Symptoms:
(please refer to the code found at the above web site)
  1. the label appears, but the colors are not correct
  2. the text entry field does not expand to the size of the supplied static string
  3. nothing happens when I type text and press ENTER.
  4. BUTTON works as expected.

Here is the code that is giving me fits:
Code:
class  simpleapp_wx(wx.Frame):
.
.
.
    def initialize(self):
        #--- load our layout manager
        sizer = wx.GridBagSizer( )

        #--- prepare for text entry
        self.entry = wx.TextCtrl( self, -1, value=u"Enter text here.")
        sizer.Add(self.entry,(0,0),(1,1),wx.EXPAND)
        self.Bind(wx.EVT_TEXT_ENTER,self.OnPressEnter,self.entry )

        #--- next we need the button
        button = wx.Button( self,-1,label="Click me!")
        sizer.Add(button, (0,1) )
        self.Bind(wx.EVT_BUTTON,self.OnButtonClick,button)

        #--- we need a label
        self.label = wx.StaticText( self, -1, label=u"Hello!")
        self.label.SetBackgroundColour( wx.BLUE )
        self.label.SetForegroundColour( wx.WHITE )
        sizer.Add(self.label,(1,0),(1,2),wx.EXPAND )

        #--- now we want to permit dialog to 'resize' 
        sizer.AddGrowableCol( 0 )
        self.SetSizerAndFit( sizer )
        #..... limit to horizontal resize
        self.SetSizeHints( -1, self.GetSize().y, -1, self.GetSize().y )
        self.entry.SetFocus( )
        self.entry.SetSelection( -1, -1 )
        self.Show( True )
I'd love to look at what is happening with xev -id or similar, but I've no idea how to discover the needed X-window ID to watch. That should clearly show how dated and rusty my skills are.

My workstation is Linux Mint 17.3. python --version reports v2.7.6.
Thanks to my distro, I have a mix of v2 and v3 Python installed.
I suspect that I'm seeing some differences between what the web site example expects and what is provided by my available Python and modules. I have no idea how to find these problems with versions and such.

I built the TKinter edition from the same web site and all worked as expected.
 
Old 05-31-2016, 03:39 PM   #3
notKlaatu
Senior Member
 
Registered: Sep 2010
Location: Lawrence, New Zealand
Distribution: Slackware
Posts: 1,075

Rep: Reputation: 725Reputation: 725Reputation: 725Reputation: 725Reputation: 725Reputation: 725Reputation: 725
It would be more useful if you would include the full code sample.

I believe your problem has nothing to do with Python 2 vs 3. But it's hard to say what the problem is without seeing what you are actually running.

I highly recommend zetcode.com for really good wxPython (he has both a beginner's guide and advanced). It's an amazing site with solid examples that you can build up from.

Last edited by notKlaatu; 05-31-2016 at 03:46 PM.
 
Old 05-31-2016, 04:17 PM   #4
SaintDanBert
Senior Member
 
Registered: Jan 2009
Location: "North Shore" Louisiana USA
Distribution: Mint-20.1 with Cinnamon
Posts: 1,720

Original Poster
Blog Entries: 3

Rep: Reputation: 107Reputation: 107
FOLLOW-UP

I did some code reading in the /wx/... python package sources. A handy comment explained that I could use this fragment:
Code:
        #--- we need a label 
        self.label = wx.StaticText( self, -1, label=u"Hello!")
        self.label.SetBackgroundColour( 'BLUE' )
        self.label.SetForegroundColour( 'WHITE' )
instead of this fragment:
Code:
        #--- we need a label 
        self.label = wx.StaticText( self, -1, label=u"Hello!")
        self.label.SetBackgroundColour( wx.BLUE )
        self.label.SetForegroundColour( wx.WHITE )
Given that Python is mostly interpreted, I think that the string is more readable than a constant inside of the wx-object somewhere.

By the way, the fragment still does not display as expected. I suspect that there are also some X-windows and widgets details that I need to learn.

Thanks in advance,
~~~ 0;-/
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Setting up the python virtualenv development environment on Debian Linux LXer Syndicated Linux News 0 04-13-2015 01:31 AM
LXer: Linux Mint Xfce - a new spin based on Debian Testing, plus questions answered by Mint guru Cle LXer Syndicated Linux News 0 04-14-2011 05:00 AM
Linux Mint instead of Ubuntu as a general purpose / development laptop paulsiu Ubuntu 5 02-10-2009 06:38 AM
Python Qt development setup question pajamabama Programming 4 06-03-2006 09:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration