473,465 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

newbie doubt about MVC,tkinter

hi
i am trying to write a controller that creates a Tkinter gui,takes
userevents from gui and calls another program to do some calculation
and finally returns the results to gui to be displayed.

I tried to separate these three like MVC pattern
however ,being a newbie i have some doubts

sample gui class

class MyGUI:
def __init__(self, parent):
self.controller=MyController()
self.myParent = parent
self.mainframe = Frame(parent,background="grey")
self.mainframe.pack(fill=BOTH,expand=YES)
...

def button1Click(self):
controller.callback(uservalue)

def showResult(resultvalue):
//display on canvas
class MyController:
def createGUI(self):
root = Tk()
root.wm_title("MyGUI")
self.myapp = MyGUI(root)
root.mainloop()

def callback(value):
self.userenteredvalue=value
def callGUI(self,resultvalue):
self.myapp.showResult(resultvalue)

if __name__ == "__main__":
controller=MyController()
controller.createGUI()
resultTodisplay=self.userenteredvalue+1000 # or may be call some
program to do the calc
controller.callGUI(resultTodisplay)

Here,root.mainloop() causes the application to go into Tk event loop
and the controller will not be able to interact with the gui until i
close the window.

I was wondering if i can keep the gui window open and at the same time
call the gui objects methods from my controller.If anyone can help/
advise please do
thanks
gordon
Aug 27 '08 #1
0 904

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: srijit | last post by:
Hello, Any idea - why the following code crashes on my Win 98 machine with Python 2.3? Everytime I run this code, I have to reboot my machine. I also have Win32all-157 installed. from Tkinter...
0
by: mahesh | last post by:
Hi all, I have a doubt with OOAD and Dialogs. I have a Dialog Class. tkSimple.py It contains a class body as below. Now I am calling the tkSimple.py in another python program and using the...
7
by: SeeBelow | last post by:
Do many people think that wxPython should replace Tkinter? Is this likely to happen? I ask because I have just started learning Tkinter, and I wonder if I should abandon it in favor of...
3
by: Manish Gupta (BBS) | last post by:
Hello invoking something like following - sock.send(100) generates the following error - TypeError: send() argument 1 must be string or read-only buffer, not int
0
by: syed_saqib_ali | last post by:
Below is a simple code snippet showing a Tkinter Window bearing a canvas and 2 connected scrollbars (Vertical & Horizontal). Works fine. When you shrink/resize the window the scrollbars adjust...
1
by: Michael Yanowitz | last post by:
Hello: Below I have included a stripped down version of the GUI I am working on. It contains 2 dialog boxes - one main and one settings. It has the following problems, probably all related, that...
8
by: karthikbalaguru | last post by:
Hi, One of my python program needs tkinter to be installed to run successfully. I am using Redhat 9.0 and hence tried installing by copying the tkinter-2.2.2-36.i386.rpm alone from the CD 3 to...
3
by: joshdw4 | last post by:
I hate to do this, but I've thoroughly exhausted google search. Yes, it's that pesky root window and I have tried withdraw to no avail. I'm assuming this is because of the methods I'm using. I...
0
by: Guilherme Polo | last post by:
On Sat, Sep 20, 2008 at 4:10 PM, dmitrey <dmitrey15@ukr.netwrote: It is not only the button that doesn't respond, the entire application won't respond if you are blocking tcl from processing...
1
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
Oralloy
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,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.