python


How to display a function output/result in another window/frame using tkinter


i'm currently trying to creat a small accounting program where the user should type his earnings and expanses and the program should count it and display the differnt transactions in an secound frame. Im stuck at this point: So far ive created 6 frames where the user can switch between with buttons.
When the user click on the button "first transaction" he can entry a ammount and after he click on validate the ammount is displaying under the button.
But i want that the ammount is display at the frame "transaction overview"
After hours spending with searching the web i couln't find a way to display a functions output on a secound frame/window in the App. Thanks for your helf.
class Finanzapp(tk.Tk):
def get_page(self, classname):
for page in self.frames.values():
if str(page.__class__.__name__) == classname:
return page
return None
def __init__(self, *args, **kwargs):
tk.Tk.__init__(self, *args, **kwargs)
tk.Tk.wm_title(self, "Finanz Manager V2")
container = tk.Frame(self)
container.pack(side="top", fill="both", expand = True)
container.grid_rowconfigure(0, weight=1)
container.grid_columnconfigure(0, weight=1)
self.frames = {}
for F in (StartPage, PageOne, PageTwo, PageThree, Pagefour, Pagefive):
frame = F(container,self)
self.frames[F] = frame
frame.grid(row=0, column = 0, sticky="nsew")
self.show_frame(StartPage)
def show_frame(self, cont):
frame = self.frames[cont]
frame.tkraise()
class StartPage(tk.Frame):
def __init__(self, parent, controller):
self.controller = controller
tk.Frame.__init__(self,parent)
label = tk.Label(self, text="Start Page", font=LARGE_FONT)
label.pack(pady=10,padx=10)
button1 = ttk.Button(self, text="erste Buchung",
command=lambda: controller.show_frame(PageOne)) # add a page
button1.pack()
button2 = ttk.Button(self, text="Konten",
command=lambda: controller.show_frame(PageTwo)) # add a page
button2.pack()
button3 = ttk.Button(self, text="neue Buchung",
command=lambda: controller.show_frame(PageThree)) # add a page
button3.pack()
button4 = ttk.Button(self, text="Kategorien",
command=lambda: controller.show_frame(Pagefour)) # add a page
button4.pack()
button5 = ttk.Button(self, text="Übersicht",
command=lambda: controller.show_frame(Pagefive)) # add a page
button5.pack()
button6 = ttk.Button(self, text="Diagramm",
command=lambda: controller.show_frame(StartPage)) # add a page
button6.pack()
class PageOne(tk.Frame):
def __init__(self, parent, controller):
self.controller = controller
tk.Frame.__init__(self, parent)
label = tk.Label(self, text="erste Buchung", font=LARGE_FONT)
label.pack(pady=10,padx=10)
button1 = ttk.Button(self, text="zurück",
command=lambda: controller.show_frame(StartPage)) # add a page
button1.pack()
def calc():
monthly_earning = float(m_earning.get())
labelresult1 = Label(self, text='gebucht: € %.2f' % monthly_earning).pack()
label1 = Label(self, text='Enter the amount').pack()
m_earning=StringVar()
earning=Entry(self, textvariable=m_earning).pack()
buttoncalc=Button(self,text='Buchen', command=calc).pack()
class PageTwo(tk.Frame):
def __init__(self, parent, controller):
def get_page(self,PageOne):
def print_it(self):
page_one = self.controller.get_page("PageOne")
value = page_one.monthly_m_earning.get()
labelresult2 = Label(self, text='gebucht: € %.2f' % value).pack()
self.controller = controller
tk.Frame.__init__(self, parent)
label = tk.Label(self, text="Konten", font=LARGE_FONT)
label.pack(pady=10,padx=10)
button1 = ttk.Button(self, text="zurück",
command=lambda: controller.show_frame(StartPage))
button1.pack()

Related Links

Converting a Doc object into a string in python
python socket.recv/sendall call blocking
Python - CSV: Large file with rows of different lengths
Intersections of 3D polygons in python
The memory usage reported by guppy differ from ps command
How to draw complement of a network graph?
how to concatenate lists in python?
Dynamic form field generation in Django templates
BeautifulSoup - easy way to to obtain HTML-free contents
Python LEPL LineAwareConfiguration trouble
How to assert that zero or only one of N given arguments is passed
Given a latitude and longitude, and distance, I want to find a bounding box
Abstract base class inheritance in Django with foreignkey
Designing a simple network packet
Slice a string after a certain phrase?
Google Analytics and Python

Categories

HOME
json
tensorflow
google-apps-script
sas
vue.js
cluster-computing
reverse-engineering
textwatcher
performancecounter
ncurses
ocaml
youtube-livestreaming-api
thunderbird-addon
search-engine
webdav
simpy
eval
keystore
cpanel
local
python-unicode
prestodb
ng2-dragula
google-maps-android-api-2
fop
source-maps
fabric
auditing
solidworks
data-conversion
crt
pari
entity-system
clockwork
m2e
hotmail
receipt
fabric-digits
qtablewidget
recurrence-relation
google-guava-cache
broadleaf-commerce
image-compression
freetts
onbackpressed
control-flow-graph
worker
bids
windows-firewall
text-classification
rpostgresql
nuget-server
execl
gulp-typescript
build-process
payu
coremidi
packagemaker
asteriskami
database-backups
gradle-eclipse
eml
cctray
android-cursoradapter
android-viewholder
hornetq
wikitext
prezto
word-2013
belongs-to
qtestlib
x-ua-compatible
suffix-array
dto
code-testing
broadcasting
resource-files
visual-c++-2010-express
arangodb-php
nservicebus4
shiva3d
cbcentralmanager
userid
driving-directions
rubycas
ruby-debug
adobe-contribute
j-interop
idictionary
visual-c++-2008-express
openvg
dotproject

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App