473,395 Members | 1,616 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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,parent):
Tk.__init__(self,parent)
self.parent=parent
self.initialize()

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

def openchild1(self):
c1 =
Toplevel(self,bg="#aabbcc",height=300,width=300,bo rderwidth=1)
c1.title("Child One")

c1.resizable(width=NO,height=NO)
F = Frame(c1,height=40,width=300)
F.pack(side=TOP,fill=X,expand=1)
llb=Label(F,text="Enter command..")
llb.pack(side=LEFT,padx=1)
ent = Entry(F,width=50)
ent.pack(side=LEFT,padx=2,expand=1)
bCl = Button(F,text="Clear Text",command=self.clearentry)
bCl.pack(side=LEFT,padx=2, pady=0)
bQt = Button(F,text="Quit", command=F.quit)
bQt.pack(side=RIGHT,padx=1, pady=0)

F1=Frame(c1,relief=SUNKEN,height=330,width=300)
txt=Text(F1)

scr=Scrollbar(F1,orient=VERTICAL,command=txt.yview ,bg="green",width=20)
txt.insert(END,"inside txt...")
txt.config(yscrollcommand=scr.set)
F1.pack(side=TOP,fill=X,expand=1)
txt.pack(side=LEFT,fill=BOTH,padx=1)
scr.pack(side=RIGHT,fill=Y)

F2=Frame(c1,height=30,width=300,relief=RAISED)
F2.pack(side=BOTTOM,fill=X,expand=1)
llb1=Label(F2,text=" Low Down statusbar")
llb1.pack(side=LEFT)

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

def openchild2(self):
c2 =
Toplevel(self,bg="red",height=200,width=200,border width=1)
c2.geometry('200x200')
c2.resizable(width=NO,height=NO)
c2.title("Child Two")
Label(c2, text="This is a regular toplevel
window.").pack(side=TOP)
if __name__=="__main__":
obj=toplevel1(None)
obj.title('Main Window')
obj.mainloop()
Sep 1 '08 #1
0 972

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

Similar topics

4
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...
3
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...
32
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?)...
26
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...
4
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...
1
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...
5
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...
1
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...
1
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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...
0
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
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...

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.