Set OK button permanently OK bypassing the dialogue

I am the programmer with a learner plate. There is a dialogue in the
same wxpython programme which I posted on 28 Apr. By calling the dialogue, the original design allows:

the price and quantity be changed by the cashier,

the system would check 2 dictionaries for duplicates and adjust
the prices and quantity.

Is it possible to set LN 15 OK button to OK permanently? There will
be no need for human intervention for each input. To dismantle the
dialogue would need a lot of programming beyond my capability now.TKS

onselect.py (3.55 KB)

I’m not sure I understand “set LN 15 OK button to OK permanently”. Does that mean that you want to display the dialog and then have it exit immediately with an OK status as if the OK button was clicked? That seems fairly terrible from a UX perspective, but if you really want to go that way then the dialog code could do it by calling self.EndModal(wx.ID_OK) when it decides it’s ready to exit.

···

On Thursday, May 30, 2019 at 2:01:31 AM UTC-7, d chung wrote:

I am the programmer with a learner plate. There is a dialogue in the
same wxpython programme which I posted on 28 Apr. By calling the dialogue, the original design allows:

the price and quantity be changed by the cashier,

the system would check 2 dictionaries for duplicates and adjust
the prices and quantity.

Is it possible to set LN 15 OK button to OK permanently? There will
be no need for human intervention for each input. To dismantle the
dialogue would need a lot of programming beyond my capability now.TKS

Robin

Dear masters,

I am moving on.

I cut away the dlg part and replaced it with some fixed values.

Everything works fine except that the bar code has been read 248 times and there is no loop in the codes. It was entered only once. What went wrong?

Chung

···

On Thursday, 30 May 2019 17:01:31 UTC+8, d chung wrote:

I am the programmer with a learner plate. There is a dialogue in the
same wxpython programme which I posted on 28 Apr. By calling the dialogue, the original design allows:

the price and quantity be changed by the cashier,

the system would check 2 dictionaries for duplicates and adjust
the prices and quantity.

Is it possible to set LN 15 OK button to OK permanently? There will
be no need for human intervention for each input. To dismantle the
dialogue would need a lot of programming beyond my capability now.TKS

You haven’t shown us anything about a bar code, so we can’t possibly address that. You did

I do want to point out that this line will never succeed:

if self.input[2] != 0 and not self.input[2]:

That says “if input 2 is not 0 and input 2 is 0.” It can never be both. I can’t guess what you really intended there.

I’m also concerned about these linesL

self.m1, self.t1 = ‘’, ‘’

self.Language()

wx.MessageBox(self.m1, self.t1)

Is the “self.Language()” call going to modify the values of self.m1 and self.t1? If so, that’s a very poor design, because you’re relying on side effects. A person looking at your code would have no way to know that the function call is modifying other variables. If that’s looking up a language translation, it would be much better to pass them as parameters:

m1, t1 = self.Language( ‘’, ‘’ )

Now it’s absolutely clear what goes in, and what comes out.

···

On Jun 22, 2019, at 2:23 AM, d chung dommchung@gmail.com wrote:

I cut away the dlg part and replaced it with some fixed values.

Everything works fine except that the bar code has been read 248 times and there is no loop in the codes. It was entered only once. What went wrong?


Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Dear Tim,

I pirated a kind-hearted man’s open-source programme for my own use.

The bar code is
entered here.

Line 229 self.search_text = (self.search_bar.GetValue()).split()

The original design
was bring up a dialogue. All data would be stored in self.input [ ].
I deleted the dialogue.

Line 258 self.input =
[self.selected_info[0],self.selected_info[1],self.selected_info[3],‘1’]

The barcode has been read 248 times or more although it was entered once.

TKS

Dom

pnl_pos.py (25.9 KB)

posdup.jpg

···

On Thursday, 30 May 2019 17:01:31 UTC+8, d chung wrote:

I am the programmer with a learner plate. There is a dialogue in the
same wxpython programme which I posted on 28 Apr. By calling the dialogue, the original design allows:

the price and quantity be changed by the cashier,

the system would check 2 dictionaries for duplicates and adjust
the prices and quantity.

Is it possible to set LN 15 OK button to OK permanently? There will
be no need for human intervention for each input. To dismantle the
dialogue would need a lot of programming beyond my capability now.TKS

I pirated a kind-hearted man’s open-source programme for my own use.

The bar code is entered here.

Line 229 self.search_text = (self.search_bar.GetValue()).split()

The original design was bring up a dialogue. All data would be stored in
self.input [ ]. I deleted the dialogue.

Line 258 self.input =
[self.selected_info[0],self.selected_info[1],self.selected_info[3],'1']
The barcode has been read 248 times or more although it was entered once.

Given that description I would look for code which receives a
string from the barcode reader and then erroneously loops
over each of the characters in the string rather than
treating it as a whole.

Since you

I deleted the dialogue.

you need to be 100% sure what the program logic is.

Karsten

···

On Wed, Jun 26, 2019 at 09:00:56PM -0700, d chung wrote:
--
GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B

Dear Karsten,
Thank you.
I have worked on the wxpython programme for 4 months and understood
the logic very well.The barcode entry and everything was working fine.
I only had the courage to cut away the dlg last week without changing
anything.
regards,
Dom

···

On 6/27/19, Karsten Hilbert <Karsten.Hilbert@gmx.net> wrote:

On Wed, Jun 26, 2019 at 09:00:56PM -0700, d chung wrote:

I pirated a kind-hearted man’s open-source programme for my own use.

The bar code is entered here.

Line 229 self.search_text = (self.search_bar.GetValue()).split()

The original design was bring up a dialogue. All data would be stored in
self.input [ ]. I deleted the dialogue.

Line 258 self.input =
[self.selected_info[0],self.selected_info[1],self.selected_info[3],'1']
The barcode has been read 248 times or more although it was entered once.

Given that description I would look for code which receives a
string from the barcode reader and then erroneously loops
over each of the characters in the string rather than
treating it as a whole.

Since you

I deleted the dialogue.

you need to be 100% sure what the program logic is.

Karsten
--
GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B

--
You received this message because you are subscribed to the Google Groups
"wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to wxpython-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/wxpython-users/20190627072122.GA3188%40hermes.hilbert.loc.
For more options, visit https://groups.google.com/d/optout.

The bar code is entered here.

Line 229 self.search_text = (self.search_bar.GetValue()).split()

Line 258 self.input = [self.selected_info[0],self.selected_info[1],self.selected_info[3],‘1’]

The barcode has been read 248 times or more although it was entered once.

Of course, because this is in self.OnSearch, which is bound to the wx.EVT_TEXT event. EVT_TEXT is fired every time the textbox changes. If the bar code reader enters 248 characters, the textbox will change 248 times, and the event will be fired 248 times. If you type “12345”, you’ll get an EVT_TEXT for “1”, and then for “12”, and then for “123”, and then for “1234”, and then for “12345”.

Does the barcode reader have any special character at the end of the string? Or, do you know how long the string is supposed to be? You can just call evt.Skip and return if self.search_bar.GetValue() is not long enough, or does not have the proper ending character.

···

On Jun 26, 2019, at 9:00 PM, d chung dommchung@gmail.com wrote:

Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Dear masters,

The original design for the search was to look for anything. There was a split( ). I fixed the input to only bar code. The whole world collapsed with the bar code truncated Thank you guys.

···

On Thursday, 30 May 2019 17:01:31 UTC+8, d chung wrote:

I am the programmer with a learner plate. There is a dialogue in the
same wxpython programme which I posted on 28 Apr. By calling the dialogue, the original design allows:

the price and quantity be changed by the cashier,

the system would check 2 dictionaries for duplicates and adjust
the prices and quantity.

Is it possible to set LN 15 OK button to OK permanently? There will
be no need for human intervention for each input. To dismantle the
dialogue would need a lot of programming beyond my capability now.TKS