473,805 Members | 2,297 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Multiple window handling

Hi!!
I'm trying to program an application which have multiple windows and
is capable of executing method defined inside class of one another, i
tries a simpel frame work here and am creating Toplevel inside method
as the new window to be genereated, and again want another window to
be loaded when the widget inside toplevel is executed as
necessary..but am feeling lost to either create a class for such new
window or write function again..

also, when running clearentry() it is not working...have i missed
something here..

Programming with multiple window is main task for me..so how it can be
done???

the code i tried is here,

from Tkinter import *
import sys
import os

class toplevel1(Tk):
def __init__(self,p arent):
Tk.__init__(sel f,parent)
self.parent=par ent
self.initialize ()

def initialize(self ):
label=Label(sel f, text="Toplevel Practice").pack (side=TOP)
button1=Button( self,text="Chil d
1",command=self .openchild1).pa ck(side=LEFT)
button2=Button( self,text="Chil d
2",command=self .openchild2).pa ck(side=LEFT)
self.resizable( width=NO,height =YES)
self.geometry(' 300x300')

def openchild1(self ):
c1 =
Toplevel(self,b g="#aabbcc",hei ght=300,width=3 00,borderwidth= 1)
c1.title("Child One")

c1.resizable(wi dth=NO,height=N O)
F = Frame(c1,height =40,width=300)
F.pack(side=TOP ,fill=X,expand= 1)
llb=Label(F,tex t="Enter command..")
llb.pack(side=L EFT,padx=1)
ent = Entry(F,width=5 0)
ent.pack(side=L EFT,padx=2,expa nd=1)
bCl = Button(F,text=" Clear Text",command=s elf.clearentry)
bCl.pack(side=L EFT,padx=2, pady=0)
bQt = Button(F,text=" Quit", command=F.quit)
bQt.pack(side=R IGHT,padx=1, pady=0)

F1=Frame(c1,rel ief=SUNKEN,heig ht=330,width=30 0)
txt=Text(F1)

scr=Scrollbar(F 1,orient=VERTIC AL,command=txt. yview,bg="green ",width=20)
txt.insert(END, "inside txt...")
txt.config(yscr ollcommand=scr. set)
F1.pack(side=TO P,fill=X,expand =1)
txt.pack(side=L EFT,fill=BOTH,p adx=1)
scr.pack(side=R IGHT,fill=Y)

F2=Frame(c1,hei ght=30,width=30 0,relief=RAISED )
F2.pack(side=BO TTOM,fill=X,exp and=1)
llb1=Label(F2,t ext=" Low Down statusbar")
llb1.pack(side= LEFT)

def clearentry(self ):
self.ent.delete (0,END)

def openchild2(self ):
c2 =
Toplevel(self,b g="red",height= 200,width=200,b orderwidth=1)
c2.geometry('20 0x200')
c2.resizable(wi dth=NO,height=N O)
c2.title("Child Two")
Label(c2, text="This is a regular toplevel
window.").pack( side=TOP)
if __name__=="__ma in__":
obj=toplevel1(N one)
obj.title('Main Window')
obj.mainloop()
Sep 1 '08 #1
0 1002

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

Similar topics

4
31202
by: john | last post by:
How do u guys handle multiple sessions?? i.e, opening different browser windows by running iexplore.exe or clicking IE icons and opening the application. My sessions are mixing up. what i mean is suppose i log in my site using username "test". At this time I set $_SESSION="test". And I use $_SESSION inside my application to print the username. Now if I open another browser & log in with "another test" the session
3
2003
by: Disco-181 | last post by:
Hi, I have a script which isn't working in Mozilla based browser for some reason. I'm trying to run two functions from the body onload tag and it simply isn't happening. I have a cascading menu, where the primary dropdown selection determines the contents of a second dropdown. This is triggered by a function in the onchange tag of the primarys select tag. When triggered like this, the function and drop downs work fine. When
32
2523
by: Eli | last post by:
How can I POST a form into a new window where I control the size and other attributes of the new window? Also. Are there any implications, perhaps due to browser security (Interne Explorer?) that could cause problems if I try to post a form at www.mydomain.com to www.anotherdomain.com?
26
5694
by: yb | last post by:
Hi, Is there a standard for the global 'window' object in browsers? For example, it supports methods such as setInterval and clearInterval, and several others. I know that w3c standardized several parts of the DOM, but this does not include the window object. Thank you
4
3239
by: johkar | last post by:
Why does this code work in IE and Firefox and the second example does not work in IE. While these are just sample scripts, my actual scripts will be transferring options from one multi-select list to another. I want the most recently added one to scroll into view. Works in both: <html> <head> <title>test</title> </head>
1
3032
by: metsys | last post by:
We have an ASP.NET 2.0 (C#) application that is divided into multiple layers. The multiple layers come from having a web project and 2 different class library projects in the same solution. I'm having difficulties figuring out the best way to handle (catch) exceptions in the different layers and then propagating those errors back up through the call stack to ultimately display something to the end-user. Note this is an intranet...
5
2931
by: Pete Verdon | last post by:
I'm working on a fairly sizeable javascript application. I recently added some error-handling to it, using window.onerror to catch them. This sometimes works and sometimes doesn't; if I introduce a deliberate mistake "near the top" of the system then it's trapped and handled properly, but there's lots of code where mistakes only show up in my Firebug console. My first thought is that, since a lot of the work happens in callbacks after...
1
2022
by: bizt | last post by:
Hi, I am having my first real attempt at an ajax class as so far Ive managed to build one that, once instatiated, will allow me to define which function it will call on completion then retrieves the contents from a server side script as AJAX generally does and process it using that function. This far Im quite pleased with it, however, I really want something that will allow me to perform multiple AJAX calls from the same script. I...
1
1318
by: Thomas 'PointedEars' Lahn | last post by:
jodleren wrote: ECMAScript functions do not have arity (a fixed number of arguments that they take). This means *all* arguments are optional on call. Whether they are also implemented as being optional, depends on you/the function's developer. For example: function openDirSel(input, user) { /*
0
9596
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,...
0
10617
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, 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...
0
10364
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10370
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10109
tracyyun
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...
1
7649
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5545
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...
0
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4328
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 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.