The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 Forum for Python
 slider in Origin

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
cts18488 Posted - 03/15/2023 : 4:53:38 PM
Origin Ver. 2021b and Service Release (Select Help-->About Origin):
Operating System: Win 100 Ent

Is it possible to add a slider in Origin with Python coding? For example I have a 4x4 subplots and I want to control the background colour with the slider. If the slider is on 0 all the subplots to have transparent background. As the position of the slider moves, the corresponding subplot to change its background colour (to yellow for example)

Thank you.
6   L A T E S T    R E P L I E S    (Newest First)
YimingChen Posted - 03/30/2023 : 2:16:55 PM
Here is another example to adjust the contour colormap transparency. To try the script, please install the 2023b beta version.


from tkinter import *
import originpro as op

def update1(event):
    gl = op.find_graph()[0]
    gl.set_int("cmap.transparency", event)
    
def update2(event):
    gl = op.find_graph()[1]
    gl.set_int("cmap.transparency", event)
    
parent = Tk()
parent.geometry("220x120")
sli1 = Scale(parent, from_=0, to=100, tickinterval=20, length= 200, orient=HORIZONTAL, command=update1)
sli2 = Scale(parent, from_=0, to=100, tickinterval=20, length= 200, orient=HORIZONTAL, command=update2)

sli1.pack()
sli2.pack()
mainloop()




https://my.originlab.com/ftp/forum_and_kbase/Images/transparentContour.oggu

James
YimingChen Posted - 03/30/2023 : 1:04:36 PM
Here is the example code to change the layer background through a slider.

from tkinter import *
import originpro as op

def update(event):
    global prev
    gl = op.find_graph()[prev]
    gl.set_int("TRANSPARENCY", 100) 
    
    cur = int(event) - 1
    gl = op.find_graph()[cur]
    gl.set_int("TRANSPARENCY", 0)   
    prev = cur
    
prev = 0
parent = Tk()
parent.geometry("520x80")
sli1 = Scale(parent, from_=0, to=16, tickinterval=4, length= 500, orient=HORIZONTAL, command=update)
sli1.pack()
mainloop()



https://my.originlab.com/ftp/forum_and_kbase/Images/changeBackground.opju

James
YimingChen Posted - 03/27/2023 : 11:26:23 AM
You could install the Python package tinker to create the slider.
https://www.originlab.com/doc/python/Python-Packages#Using_the_Python_Packages_Tool

Try the sample script below:

from tkinter import *
import originpro as op

def update(event):
    gl = op.find_graph()[0]
    gl.set_int("TRANSPARENCY", event)   

parent = Tk()
parent.geometry("520x80")
sli1 = Scale(parent, from_=0, to=100, tickinterval=25, length= 500, orient=HORIZONTAL, command=update)
sli1.pack()
mainloop()




James
cts18488 Posted - 03/27/2023 : 04:18:59 AM
Would it be possible to show me how to do this in Python? How to call LT and do the background modification using the slider?
quote:
Originally posted by cpyang

This can be done if can call LT from Python which in turn call an Origin C function. See

https://my.originlab.com/forum/topic.asp?TOPIC_ID=46189


We currently don't have built-in GUI support in originpro package.

CP




cpyang Posted - 03/21/2023 : 9:48:02 PM
This can be done if can call LT from Python which in turn call an Origin C function. See

https://my.originlab.com/forum/topic.asp?TOPIC_ID=46189


We currently don't have built-in GUI support in originpro package.

CP


cts18488 Posted - 03/21/2023 : 4:08:24 PM
Can anyone tell me if this is achievable? Thank you!

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000