Hi,
I am a newbie in python programming. I have just been playing with Python for two weeks now, and I really feel comfortable with Python. Now I am learning the GUI programming with python. And I am working with pywin to create the gui. I found it is hard to learn pywin. It seems like you need to have a solid background of MFC in order to learn the gui side of pywin. Is there any tutorials out there can help my learning curve? I have been searching out there, and I can not really find anything good. Thank you for any pointers.
14 2713
Hi,
I am a newbie in python programming. I have just been playing with Python for two weeks now, and I really feel comfortable with Python. Now I am learning the GUI programming with python. And I am working with pywin to create the gui. I found it is hard to learn pywin. It seems like you need to have a solid background of MFC in order to learn the gui side of pywin. Is there any tutorials out there can help my learning curve? I have been searching out there, and I can not really find anything good. Thank you for any pointers.
You are so right about PythonWin! I don't know anybody who uses it. For beginners, there's Tkinter. I'm using wxPython. Here is a good place to start with Tkinter. Have fun!
Cool. Thanks for the advice. I thought it is just me. I will look into wxPython and wxWidgets too.
Cool. Thanks for the advice. I thought it is just me. I will look into wxPython and wxWidgets too.
You are welcome. Come on back if you ever have a need for wxPython help. Welocme to TheScripts!
Hi,
I am still playing around with pywin (gui). And I found out that if you want to run a dialog box. You can use the "DoModal" function. Once the function called, you can not made any changes anymore to the gui. This is not really what i have in mind. Says.. I want a dialog box to spit out text like "Welcome", and then after that it will change to the progress bar. Basically I would like to be able to change the gui dynamically according to certain situation. Is that possible at all? If it is, would anyone give me some directions on how to do it? Thanks in advance
Hi,
I am still playing around with pywin (gui). And I found out that if you want to run a dialog box. You can use the "DoModal" function. Once the function called, you can not made any changes anymore to the gui. This is not really what i have in mind. Says.. I want a dialog box to spit out text like "Welcome", and then after that it will change to the progress bar. Basically I would like to be able to change the gui dynamically according to certain situation. Is that possible at all? If it is, would anyone give me some directions on how to do it? Thanks in advance
Yes, it is possible. Of course, I don't know if the MFC will let you do it, but wx will. All dialogs in wxPython are just ordinary frames with a couple of added features (like ShowModal() for waiting until the user clicks a button before the main program will continue). If it is modal, all the action would come from the dialog subclass. Non-modal dialogs can be changed dynamically from the main program. Hope that helps.
Cool. So it is possible after all. I am just frustated with Pywin. Having spend so much time on it, but can not find anything or get anything to work at all. I will be start looking at wxPython. And I think I have to concentrate on the "Non-modal dialog". Again, thank you very much for the pointer.
Yes, it is possible. Of course, I don't know if the MFC will let you do it, but wx will. All dialogs in wxPython are just ordinary frames with a couple of added features (like ShowModal() for waiting until the user clicks a button before the main program will continue). If it is modal, all the action would come from the dialog subclass. Non-modal dialogs can be changed dynamically from the main program. Hope that helps.
Is it possible to change the text without user interactions? I would like to have the text in the gui changed according to the main program (mostly it is a linear based program). Here is what I tried so far, but I have no success at all: -
import wx
-
-
class MyForm (wx.Panel):
-
def __init__ (self, parent, id):
-
wx.Panel.__init__(self, parent, id)
-
self.info = wx.StaticText (self, 10, "This is my first text", wx.Point (10, 10))
-
-
def changeStaticText (self, newText):
-
self.info.SetLabel (newText)
-
-
-
app = wx.PySimpleApp()
-
frame = wx.Frame (None, -1, "Fun with wxPython")
-
myForm = MyForm (frame, -1)
-
frame.Show (True)
-
app.MainLoop()
-
-
# Change the text dynamically after the panel is created.
-
myForm.changeStaticText ("NEW line of text")
-
I really appreciate any helps that I can get. Thank you.
Is it possible to change the text without user interactions? I would like to have the text in the gui changed according to the main program (mostly it is a linear based program). Here is what I tried so far, but I have no success at all: -
import wx
-
-
class MyForm (wx.Panel):
-
def __init__ (self, parent, id):
-
wx.Panel.__init__(self, parent, id)
-
self.info = wx.StaticText (self, 10, "This is my first text", wx.Point (10, 10))
-
-
def changeStaticText (self, newText):
-
self.info.SetLabel (newText)
-
-
-
app = wx.PySimpleApp()
-
frame = wx.Frame (None, -1, "Fun with wxPython")
-
myForm = MyForm (frame, -1)
-
frame.Show (True)
-
app.MainLoop()
-
-
# Change the text dynamically after the panel is created.
-
myForm.changeStaticText ("NEW line of text")
-
I really appreciate any helps that I can get. Thank you.
It's really no problem. That's what we're here for. -
self.info.SetLabel (newText)
-
self.info.Update()
Should do the trick. I haven't tried it, but I had to call update on static text to get the background color to change. Let me know it that works for you.
It's really no problem. That's what we're here for. -
self.info.SetLabel (newText)
-
self.info.Update()
Should do the trick. I haven't tried it, but I had to call update on static text to get the background color to change. Let me know it that works for you.
By the way, did you pick up the docs and demos while you were getting the core wxPython package?
Is it possible to change the text without user interactions? I would like to have the text in the gui changed according to the main program (mostly it is a linear based program). Here is what I tried so far, but I have no success at all: -
import wx
-
-
class MyForm (wx.Panel):
-
def __init__ (self, parent, id):
-
wx.Panel.__init__(self, parent, id)
-
self.info = wx.StaticText (self, 10, "This is my first text", wx.Point (10, 10))
-
-
def changeStaticText (self, newText):
-
self.info.SetLabel (newText)
-
-
-
app = wx.PySimpleApp()
-
frame = wx.Frame (None, -1, "Fun with wxPython")
-
myForm = MyForm (frame, -1)
-
frame.Show (True)
-
app.MainLoop()
-
-
# Change the text dynamically after the panel is created.
-
myForm.changeStaticText ("NEW line of text")
-
I really appreciate any helps that I can get. Thank you.
I just had a look at one of my dialogs that changes the text on a static text object: There's no need to call Update(). It looks like you never call your function. Try adding a button that calls your function in its OnButton handler.
Or -
app = wx.PySimpleApp()
-
frame = wx.Frame (None, -1, "Fun with wxPython")
-
myForm = MyForm (frame, -1)
-
frame.Show (True)
-
wx.FutureCall(2500, myForm.changeStaticText, "time's up")
-
app.MainLoop()
-
to automatically change after 2.5 seconds.
I just had a look at one of my dialogs that changes the text on a static text object: There's no need to call Update(). It looks like you never call your function. Try adding a button that calls your function in its OnButton handler.
Or -
app = wx.PySimpleApp()
-
frame = wx.Frame (None, -1, "Fun with wxPython")
-
myForm = MyForm (frame, -1)
-
frame.Show (True)
-
wx.FutureCall(2500, myForm.changeStaticText, "time's up")
-
app.MainLoop()
-
to automatically change after 2.5 seconds.
Thank you for the reply. I tried out your code and it works.
I did pick up the docs and manual when I am downloading the wxPython core. I have gone through some tutorials about wxPython (i.e. http://wiki.wxpython.org/index.cgi/Getting_Started). I think I get it on how to code event handling for the gui if it is waiting for someone input.
I tried reverse the order of the codes.
From -
wx.FutureCall(2500, myForm.changeStaticText, "time's up")
-
app.MainLoop()
-
to -
app.MainLoop()
-
wx.FutureCall(2500, myForm.changeStaticText, "time's up")
-
And this does not really works for me. It think it is because once the MainLoop is called, the gui can not be "changed" anymore. So say if I have a gui and also a main program. The gui does not know what to expect and when to expect. It all depends on the main program. The gui will just display the results that the main program get. I have done some research on this, and it seems that to get both the gui and the main program working, i have to code them with threading. So the main program will just run by itself, and the gui will just wait for the result or command from main program. If this is not the right way to do it or there is other way to do it, please let me know
Once again, thank you very much.
Thank you for the reply. I tried out your code and it works.
I did pick up the docs and manual when I am downloading the wxPython core. I have gone through some tutorials about wxPython (i.e. http://wiki.wxpython.org/index.cgi/Getting_Started). I think I get it on how to code event handling for the gui if it is waiting for someone input.
I tried reverse the order of the codes.
From -
wx.FutureCall(2500, myForm.changeStaticText, "time's up")
-
app.MainLoop()
-
to -
app.MainLoop()
-
wx.FutureCall(2500, myForm.changeStaticText, "time's up")
-
And this does not really works for me. It think it is because once the MainLoop is called, the gui can not be "changed" anymore. So say if I have a gui and also a main program. The gui does not know what to expect and when to expect. It all depends on the main program. The gui will just display the results that the main program get. I have done some research on this, and it seems that to get both the gui and the main program working, i have to code them with threading. So the main program will just run by itself, and the gui will just wait for the result or command from main program. If this is not the right way to do it or there is other way to do it, please let me know
Once again, thank you very much.
The trick is to build all the frames of your program, then call Mainloop() and perform ALL tasks in subclasses of toplevel frames (ie Dialogs and Frames).
Once Mainloop() is called, it does just that: it loops until your program terminates.
Thanks for the tips. I will definitely give it a try.
Thanks for the tips. I will definitely give it a try.
You are welcome. It makes me think that I'll have to sit down and write an article on event driven programming vs scripting (when I get some time).
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Brandon J. Van Every |
last post by:
What's better about Ruby than Python? I'm sure there's something. What is
it?
This is not a troll. I'm language shopping and I want people's answers. I
don't know beans about Ruby or have...
|
by: Stephen C. Waterbury |
last post by:
This seems like it ought to work, according to the
description of reduce(), but it doesn't. Is this
a bug, or am I missing something?
Python 2.3.2 (#1, Oct 20 2003, 01:04:35)
on linux2
Type...
|
by: Ville Vainio |
last post by:
I don't know if you have seen this before, but here goes:
http://text.userlinux.com/white_paper.html
There is a jab at Python, though, mentioning that Ruby is more
"refined".
--
Ville...
|
by: kbass |
last post by:
In different articles that I have read, persons have constantly eluded to
the productivity gains of Python. One person stated that Python's
productivity gain was 5 to 10 times over Java in some in...
|
by: Lad |
last post by:
Is anyone capable of providing Python advantages over PHP if there are
any?
Cheers,
L.
|
by: John Coleman |
last post by:
Greetings,
I have a rough classification of languages into 2 classes: Zen
languages and tool languages. A tool language is a language that is,
well, a *tool* for programming a computer. C is the...
|
by: MilkmanDan |
last post by:
I'll be a college freshman this fall, attending Florida Institute of
Tech studying electrical engineering.
I was considering taking some classes in programming and computer
science, and I...
|
by: Mark Tarver |
last post by:
How do you compare Python to Lisp? What specific advantages do you
think that one has over the other?
Note I'm not a Python person and I have no axes to grind here. This is
just a question for...
|
by: wesley chun |
last post by:
Need to get up-to-speed with Python as quickly as possible? Come join
me, Wesley Chun, author of Prentice-Hall's bestseller "Core Python
Programming," for another comprehensive intro course plus a...
|
by: wesley chun |
last post by:
*** FINAL REMINDER
also, the course begins on monday immediately following the *free* CodeCamp
conference http://siliconvalley-codecamp.com (click Program =>
Sessions to see all the talks)... 5...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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,...
|
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,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |