I am new to python GUI and have never used python GUI before. I just decided to gave a try.
this is my function which convert local datetime to epoch, eg.py is the filename where both this functions are
def epochConverter(a):
return datetime(*a).timestamp()
This functions takes two parameters of datetime and returns in timestamp (milliseconds)
def DateExtraction(fromTime, toTime):
convertedFromTime = int(epochConverter(fromTime)*1000)
convertedtoTime = int(epochConverter(toTime)*1000)
time = {'from':convertedFromTime,'to':convertedtoTime}
return time
this works as expected
print(DateExtraction((2018,6,8,0,0,0), (2018,6,8,1,0,0)))
Now, I wanted to implement this in python GUI and I am using appjar library. This simple GUI code looks like this
from appJar import gui
from eg import DateExtraction
class MyApplication():
# Build the GUI
def Prepare(self, app):
# Form GUI
app.setTitle("Simple Application")
app.setFont(16)
app.setStopFunction(self.BeforeExit)
app.addLabel('oneTime',"From Time:", 0, 0)
app.addEntry("fromTime", 0, 1)
app.addLabel('twoTime',"To Time:", 1, 0)
app.addEntry("toTime", 1, 1)
app.addButtons(["Submit"], self.Submit, colspan=2)
return app
def Start(self):
# Creates a UI
app = gui()
app = self.Prepare(app)
self.app = app
app.go()
def BeforeExit(self):
return self.app.yesNoBox("Confirm Exit", "Are you sure you want to exit?")
def Submit(self, btnName):
if btnName == "Submit":
timefrom = self.app.getEntry("fromTime")
timeto = self.app.getEntry("toTime")
DateExtraction(timefrom, timeto)
if __name__ == '__main__':
App = MyApplication()
App.Start()
When the GUI runs, I fill both text fields as it is
2018,6,8,0,0,0
2018,6,8,1,0,0
and it throws error
TypeError: function takes at most 9 arguments (14 given)
I also tried, just in case
(2018,6,8,0,0,0)
(2018,6,8,1,0,0)
and again throws the same error
type error, functions takes bla bla arguments (bla bla given)
I am new in python GUI and any kind of suggestions is welcome. Also any suggestions about tkinter to implement above functions would be also helpful.