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

Group by min and fill NAs with value from another column Part 2
Why is SQLite trying to use form entry as a column name?
Python - Plot with pcolormesh and basemap
Is there an easy way to determine whether a string is a valid Python identifier that is not a reserved keyword? [duplicate]
Celery: Display log messages from task on webserver?
scrape site with javascript using selenium execute
Adding arguments to funcAnimation in matplotlib
Convert Python Dictionary to JSON format
Python label description
using python; read the second column, for three sections which exist in a file.txt, and then make calculations with columns
Difference in sys.argv behaviour when directly running from command line [on hold]
How to use class instance as a json or python dictionary value
Inserting more data in metadata in Django Rest Framework
Read csv file with column as literal list
Check if array row is None and assign it value
Stringing conditionals? [duplicate]

Categories

HOME
numpy
google-cloud-bigtable
mql4
crate
rotation
puppet
d
google-sheets-api
mapbox-gl-js
hana
appmaker
javamail
vsftpd
contact-form-7
constructor
pca
multiple-monitors
pdo
lstm
medium-editor
chocolatey
jsonserializer
kadanes-algorithm
distance
backpropagation
tarantool
iup
qsub
searchbar
csh
pdfsharp
tampermonkey
skmaps
ui5
ivy
red-black-tree
strophe
google-drive-realtime-api
nunit-3.0
bing-maps-api
bigcartel
forecasting
duktape
lexical-analysis
ssh.net
constants
android-maps-v2
excel-interop
gist
forerunnerdb
adler32
efxclipse
svn-merge
inject
vst
audioqueue
radians
django-filer
nssplitview
mfc-feature-pack
persistence.xml
sourcegear-vault
abas
mptcp
ubercart
scrollspy
ember-cli-addons
low-level
c++-actor-framework
ember-components
ogr2ogr
dto
bsp
valence
magic-numbers
xenocode
crystal-reports-10
circos
bignum
execvp
swrl
cgimageref
database-permissions
template-haskell
bulbs
scrollto
isolatedstorage
visual-web-gui
querystringparameter
port-scanning
smooth
junit3
mvccontrib-grid
trampolines
database-diagramming
self-reference

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